r227555 - Follow-up to r217302: Don't crash on ~A::A() if A is undeclared.
Nico Weber
nicolasweber at gmx.de
Thu Jan 29 20:05:15 PST 2015
Author: nico
Date: Thu Jan 29 22:05:15 2015
New Revision: 227555
URL: http://llvm.org/viewvc/llvm-project?rev=227555&view=rev
Log:
Follow-up to r217302: Don't crash on ~A::A() if A is undeclared.
Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/test/Parser/cxx-class.cpp
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=227555&r1=227554&r2=227555&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Thu Jan 29 22:05:15 2015
@@ -2516,7 +2516,8 @@ bool Parser::ParseUnqualifiedId(CXXScope
}
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;
}
Modified: cfe/trunk/test/Parser/cxx-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-class.cpp?rev=227555&r1=227554&r2=227555&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-class.cpp (original)
+++ cfe/trunk/test/Parser/cxx-class.cpp Thu Jan 29 22:05:15 2015
@@ -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 {
More information about the cfe-commits
mailing list