blob: 8d745de0a6a14d83d6377cc01115a54d86c6823c [file] [log] [blame]
Richard Smithf6702a32011-12-20 02:08:33 +00001// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2
3template<typename T, typename U, U> using alias_ref = T;
4template<typename T, typename U, U> void func_ref() {}
5template<typename T, typename U, U> struct class_ref {};
6
7template<int N>
8struct U {
9 static int a;
10};
11
12template<int N> struct S; // expected-note 2{{here}}
13
14template<int N>
15int U<N>::a = S<N>::kError; // expected-error 2{{undefined}}
16
17template<typename T>
18void 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
26int main() {
27 f<int>(); // expected-note 2{{here}}
28}
29
30namespace 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}