recovery-crash.cpp 1.1 KB

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