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