1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 // Clang used to crash trying to recover while adding 'this->' before Work(x); 4 5 template <typename> struct A { 6 static void Work(int); // expected-note{{must qualify identifier}} 7 }; 8 9 template <typename T> struct B : public A<T> { 10 template <typename T2> B(T2 x) { 11 Work(x); // expected-error{{use of undeclared identifier}} 12 } 13 }; 14 15 void Test() { 16 B<int> b(0); // expected-note{{in instantiation of function template}} 17 } 18 19 20 // Don't crash here. 21 namespace PR16134 { 22 template <class P> struct S // expected-error {{expected ';'}} 23 template <> static S<Q>::f() // expected-error +{{}} 24 } 25 26 namespace PR16225 { 27 template <typename T> void f(); 28 template<typename C> void g(C*) { 29 struct LocalStruct : UnknownBase<Mumble, C> { }; // expected-error {{unknown template name 'UnknownBase'}} \ 30 // expected-error {{use of undeclared identifier 'Mumble'}} 31 f<LocalStruct>(); // expected-warning {{template argument uses local type 'LocalStruct'}} 32 } 33 struct S; 34 void h() { 35 g<S>(0); // expected-note {{in instantiation of function template specialization}} 36 } 37 } 38 39 namespace test1 { 40 template <typename> class ArraySlice {}; 41 class Foo; 42 class NonTemplateClass { 43 void MemberFunction(ArraySlice<Foo>, int); 44 template <class T> void MemberFuncTemplate(ArraySlice<T>, int); 45 }; 46 void NonTemplateClass::MemberFunction(ArraySlice<Foo> resource_data, 47 int now) { 48 // expected-note@+1 {{in instantiation of function template specialization 'test1::NonTemplateClass::MemberFuncTemplate<test1::Foo>'}} 49 MemberFuncTemplate(resource_data, now); 50 } 51 template <class T> 52 void NonTemplateClass::MemberFuncTemplate(ArraySlice<T> resource_data, int) { 53 // expected-error@+1 {{use of undeclared identifier 'UndeclaredMethod'}} 54 UndeclaredMethod(resource_data); 55 } 56 // expected-error@+2 {{out-of-line definition of 'UndeclaredMethod' does not match any declaration}} 57 // expected-note@+1 {{must qualify identifier to find this declaration in dependent base class}} 58 void NonTemplateClass::UndeclaredMethod() {} 59 } 60