Follow-up to r217302: Don't crash on ~A::A() if A is undeclared.

llvm-svn: 227555
This commit is contained in:
Nico Weber 2015-01-30 04:05:15 +00:00
parent 07425af920
commit d004586faa
2 changed files with 4 additions and 1 deletions

View File

@ -2516,7 +2516,8 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
}
if (ParseOptionalCXXScopeSpecifier(SS, ObjectType, EnteringContext))
return true;
if (Tok.isNot(tok::identifier) || NextToken().is(tok::coloncolon)) {
if (Tok.isNot(tok::identifier) || NextToken().is(tok::coloncolon) ||
SS.isInvalid()) {
Diag(TildeLoc, diag::err_destructor_tilde_scope);
return true;
}

View File

@ -157,6 +157,8 @@ namespace DtorErrors {
struct D { struct X {}; ~D() throw(X); };
~D::D() throw(X) {} // expected-error {{'~' in destructor name should be after nested name specifier}}
~Undeclared::Undeclared() {} // expected-error {{use of undeclared identifier 'Undeclared'}} expected-error {{'~' in destructor name should be after nested name specifier}}
}
namespace BadFriend {