1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2 3 template <class T> struct eval; // expected-note 3{{template is declared here}} 4 5 template <template <class, class...> class TT, class T1, class... Rest> 6 struct eval<TT<T1, Rest...>> { }; 7 8 template <class T1> struct A; 9 template <class T1, class T2> struct B; 10 template <int N> struct C; 11 template <class T1, int N> struct D; 12 template <class T1, class T2, int N = 17> struct E; 13 14 eval<A<int>> eA; 15 eval<B<int, float>> eB; 16 eval<C<17>> eC; // expected-error{{implicit instantiation of undefined template 'eval<C<17>>'}} 17 eval<D<int, 17>> eD; // expected-error{{implicit instantiation of undefined template 'eval<D<int, 17>>'}} 18 eval<E<int, float>> eE; // expected-error{{implicit instantiation of undefined template 'eval<E<int, float>>}} 19 20 template< 21 template <int ...N> // expected-error {{cannot be narrowed from type 'int' to 'short'}} 22 // expected-error@-1 {{conversion from 'int' to 'void *' is not allowed in a converted constant expression}} 23 class TT // expected-note 2{{previous template template parameter is here}} 24 > struct X0 { }; 25 26 template<int I, int J, int ...Rest> struct X0a; 27 template<int ...Rest> struct X0b; 28 template<int I, long J> struct X0c; 29 template<int I, short J> struct X0d; 30 template<int I, void *J> struct X0e; // expected-note{{template parameter is declared here}} 31 32 X0<X0a> inst_x0a; 33 X0<X0b> inst_x0b; 34 X0<X0c> inst_x0c; 35 X0<X0d> inst_x0d; // expected-note {{has different template parameters}} 36 X0<X0e> inst_x0e; // expected-note{{template template argument has different template parameters than its corresponding template template parameter}} 37 38 template<typename T, 39 template <T ...N> // expected-error {{conversion from 'short' to 'void *' is not allowed in a converted constant expression}} 40 // expected-error@-1 {{cannot be narrowed from type 'int' to 'short'}} 41 class TT // expected-note 2{{previous template template parameter is here}} 42 > struct X1 { }; 43 44 template<int I, int J, int ...Rest> struct X1a; 45 template<long I, long ...Rest> struct X1b; 46 template<short I, short J> struct X1c; 47 template<short I, long J> struct X1d; 48 template<short I, void *J> struct X1e; // expected-note{{template parameter is declared here}} 49 50 X1<int, X1a> inst_x1a; 51 X1<long, X1b> inst_x1b; 52 X1<short, X1c> inst_x1c; 53 X1<short, X1d> inst_sx1d; 54 X1<int, X1d> inst_ix1d; // expected-note {{has different template parameters}} 55 X1<short, X1e> inst_x1e; // expected-note {{has different template parameters}} 56 57 template <int> class X2; // expected-note{{template is declared here}} \ 58 // expected-note{{template is declared here}} 59 class X3 : X2<1> {}; // expected-error{{implicit instantiation of undefined template 'X2<1>'}} 60 61 template <int> class X4 : X3 { 62 struct { 63 X2<1> e; // expected-error{{implicit instantiation of undefined template 'X2<1>'}} 64 } f; 65 }; 66