1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2 
3 template<typename T, typename U, U> using alias_ref = T;
4 template<typename T, typename U, U> void func_ref() {}
5 template<typename T, typename U, U> struct class_ref {};
6 
7 template<int N>
8 struct U {
9   static int a;
10 };
11 
12 template<int N> struct S; // expected-note 2{{here}}
13 
14 template<int N>
15 int U<N>::a = S<N>::kError; // expected-error 2{{undefined}}
16 
17 template<typename T>
18 void f() {
19   // FIXME: The standard suggests that U<0>::a is odr-used by this expression,
20   // but it's not entirely clear that's the right behaviour.
21   (void)alias_ref<int, int&, U<0>::a>();
22   (void)func_ref<int, int&, U<1>::a>(); // expected-note {{here}}
23   (void)class_ref<int, int&, U<2>::a>(); // expected-note {{here}}
24 };
25 
26 int main() {
27   f<int>(); // expected-note 2{{here}}
28 }
29 
30 namespace N {
31   template<typename T> struct S { static int n; };
32   template<typename T> int S<T>::n = 5;
33   void g(int*);
34   template<typename T> int f() {
35     int k[S<T>::n];
36     g(k);
37     return k[3];
38   }
39   int j = f<int>();
40 }
41