52 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2template<typename T> struct A; // expected-note 4{{template is declared here}}3 4template<typename T> struct B : A<T*> { }; // expected-error{{implicit instantiation of undefined template}} \5// expected-error{{implicit instantiation of undefined template 'A<X *>'}}6 7template<typename T> struct C : B<T> { } ; // expected-note{{instantiation of template class}}8 9template<typename T> struct D : C<T> { }; // expected-note{{instantiation of template class}}10 11template<typename T> struct E : D<T> { }; // expected-note{{instantiation of template class}}12 13template<typename T> struct F : E<T(T)> { }; // expected-note{{instantiation of template class}}14 15void f() {16 (void)sizeof(F<int>); // expected-note{{instantiation of template class}}17}18 19typedef struct { } X;20 21void g() {22 (void)sizeof(B<X>); // expected-note{{in instantiation of template class 'B<X>' requested here}}23}24 25template<typename T>26struct G : A<T>, // expected-error{{implicit instantiation of undefined template 'A<int>'}}27 A<T*> // expected-error{{implicit instantiation of undefined template 'A<int *>'}}28 { };29 30void h() {31 (void)sizeof(G<int>); // expected-note{{in instantiation of template class 'G<int>' requested here}}32}33 34namespace PR13365 {35 template <class T> class ResultTy { // expected-warning {{does not declare any constructor}}36 T t; // expected-note {{reference member 't' will never be initialized}}37 };38 39 template <class T1, class T2>40 typename ResultTy<T2>::error Deduce( void (T1::*member)(T2) ) {} // \41 // expected-note {{instantiation of template class 'PR13365::ResultTy<int &>'}} \42 // expected-note {{substitution failure [with T1 = Cls, T2 = int &]}}43 44 struct Cls {45 void method(int&);46 };47 void test() {48 Deduce(&Cls::method); // expected-error {{no matching function}} \49 // expected-note {{substituting deduced template arguments into function template 'Deduce' [with T1 = Cls, T2 = int &]}}50 }51}52