Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.
llvm-svn: 226067
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp
index 0e9a3b9..9d68cd9 100644
--- a/clang/test/Parser/cxx-class.cpp
+++ b/clang/test/Parser/cxx-class.cpp
@@ -140,8 +140,8 @@
}
namespace DtorErrors {
- struct A { ~A(); } a;
- ~A::A() {} // expected-error {{'~' in destructor name should be after nested name specifier}} expected-note {{previous}}
+ struct A { ~A(); int n; } a;
+ ~A::A() { n = 0; } // expected-error {{'~' in destructor name should be after nested name specifier}} expected-note {{previous}}
A::~A() {} // expected-error {{redefinition}}
struct B { ~B(); } *b;
@@ -151,6 +151,12 @@
a.~A::A(); // expected-error {{'~' in destructor name should be after nested name specifier}}
b->~DtorErrors::~B::B(); // expected-error {{'~' in destructor name should be after nested name specifier}}
}
+
+ struct C; // expected-note {{forward decl}}
+ ~C::C() {} // expected-error {{incomplete}} expected-error {{'~' in destructor name should be after nested name specifier}}
+
+ struct D { struct X {}; ~D() throw(X); };
+ ~D::D() throw(X) {} // expected-error {{'~' in destructor name should be after nested name specifier}}
}
namespace BadFriend {