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