1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // Clang used to crash trying to recover while adding 'this->' before Work(x); 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc template <typename> struct A { 6*f4a2713aSLionel Sambuc static void Work(int); // expected-note{{must qualify identifier}} 7*f4a2713aSLionel Sambuc }; 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc template <typename T> struct B : public A<T> { BB10*f4a2713aSLionel Sambuc template <typename T2> B(T2 x) { 11*f4a2713aSLionel Sambuc Work(x); // expected-error{{use of undeclared identifier}} 12*f4a2713aSLionel Sambuc } 13*f4a2713aSLionel Sambuc }; 14*f4a2713aSLionel Sambuc Test()15*f4a2713aSLionel Sambucvoid Test() { 16*f4a2713aSLionel Sambuc B<int> b(0); // expected-note{{in instantiation of function template}} 17*f4a2713aSLionel Sambuc } 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc // Don't crash here. 21*f4a2713aSLionel Sambuc namespace PR16134 { 22*f4a2713aSLionel Sambuc template <class P> struct S // expected-error {{expected ';'}} 23*f4a2713aSLionel Sambuc template <> static S<Q>::f() // expected-error +{{}} 24*f4a2713aSLionel Sambuc } 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc namespace PR16225 { 27*f4a2713aSLionel Sambuc template <typename T> void f(); g(C *)28*f4a2713aSLionel Sambuc template<typename C> void g(C*) { 29*f4a2713aSLionel Sambuc struct LocalStruct : UnknownBase<Mumble, C> { }; // expected-error {{unknown template name 'UnknownBase'}} \ 30*f4a2713aSLionel Sambuc // expected-error {{use of undeclared identifier 'Mumble'}} 31*f4a2713aSLionel Sambuc f<LocalStruct>(); // expected-warning {{template argument uses local type 'LocalStruct'}} 32*f4a2713aSLionel Sambuc } 33*f4a2713aSLionel Sambuc struct S; h()34*f4a2713aSLionel Sambuc void h() { 35*f4a2713aSLionel Sambuc g<S>(0); // expected-note {{in instantiation of function template specialization}} 36*f4a2713aSLionel Sambuc } 37*f4a2713aSLionel Sambuc } 38