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 5template<typename T> class A; // expected-note 2 {{template parameter is declared here}} expected-note{{template is declared here}} 6 7// [temp.arg.type]p1 8A<0> *a1; // expected-error{{template argument for template type parameter must be a type}} 9 10A<A> *a2; // expected-error{{use of class template 'A' requires template arguments}} 11 12A<int> *a3; 13A<int()> *a4; 14A<int(float)> *a5; 15A<A<int> > *a6; 16 17// Pass an overloaded function template: 18template<typename T> void function_tpl(T); 19A<function_tpl> a7; // expected-error{{template argument for template type parameter must be a type}} 20 21// Pass a qualified name: 22namespace ns { 23template<typename T> class B {}; // expected-note{{template is declared here}} 24} 25A<ns::B> a8; // expected-error{{use of class template 'ns::B' requires template arguments}} 26 27// [temp.arg.type]p2 28void 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 36struct { int x; } Unnamed; 37#if __cplusplus <= 199711L 38// expected-note@-2 {{unnamed type used in template argument was declared here}} 39#endif 40 41A<__typeof__(Unnamed)> *a9; 42#if __cplusplus <= 199711L 43// expected-warning@-2 {{template argument uses unnamed type}} 44#endif 45 46template<typename T, unsigned N> 47struct Array { 48 typedef struct { T x[N]; } type; 49}; 50 51template<typename T> struct A1 { }; 52A1<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