1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 4 5 template<typename T> class A; // expected-note 2 {{template parameter is declared here}} expected-note{{template is declared here}} 6 7 // [temp.arg.type]p1 8 A<0> *a1; // expected-error{{template argument for template type parameter must be a type}} 9 10 A<A> *a2; // expected-error{{use of class template 'A' requires template arguments}} 11 12 A<int> *a3; 13 A<int()> *a4; 14 A<int(float)> *a5; 15 A<A<int> > *a6; 16 17 // Pass an overloaded function template: 18 template<typename T> void function_tpl(T); 19 A<function_tpl> a7; // expected-error{{template argument for template type parameter must be a type}} 20 21 // Pass a qualified name: 22 namespace ns { 23 template<typename T> class B {}; // expected-note{{template is declared here}} 24 } 25 A<ns::B> a8; // expected-error{{use of class template 'ns::B' requires template arguments}} 26 27 // [temp.arg.type]p2 28 void f() { 29 class X { }; 30 A<X> * a = 0; 31 #if __cplusplus <= 199711L 32 // expected-warning@-2 {{template argument uses local type 'X'}} 33 #endif 34 } 35 36 struct { int x; } Unnamed; 37 #if __cplusplus <= 199711L 38 // expected-note@-2 {{unnamed type used in template argument was declared here}} 39 #endif 40 41 A<__typeof__(Unnamed)> *a9; 42 #if __cplusplus <= 199711L 43 // expected-warning@-2 {{template argument uses unnamed type}} 44 #endif 45 46 template<typename T, unsigned N> 47 struct Array { 48 typedef struct { T x[N]; } type; 49 }; 50 51 template<typename T> struct A1 { }; 52 A1<Array<int, 17>::type> ax; 53 54 // FIXME: [temp.arg.type]p3. The check doesn't really belong here (it 55 // belongs somewhere in the template instantiation section). 56