diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-15 00:48:52 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-15 00:48:52 +0000 |
commit | 64e033f9c4fb5a241496753f7ffcbddaa0153e5b (patch) | |
tree | 4765ce4e5bb75e1da670714cd84b7f59d4ffe594 /clang/lib/Parse/ParseExprCXX.cpp | |
parent | 8ffce23cda2a7e91d1b4c2967fed5b6c903fb474 (diff) | |
download | bcm5719-llvm-64e033f9c4fb5a241496753f7ffcbddaa0153e5b.tar.gz bcm5719-llvm-64e033f9c4fb5a241496753f7ffcbddaa0153e5b.zip |
Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.
llvm-svn: 226067
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExprCXX.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index 355503caa9b..751a90ae71d 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -2504,6 +2504,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, } // If the user wrote ~T::T, correct it to T::~T. + DeclaratorScopeObj DeclScopeObj(*this, SS); if (!TemplateSpecified && NextToken().is(tok::coloncolon)) { if (SS.isSet()) { AnnotateScopeToken(SS, /*NewAnnotation*/true); @@ -2520,6 +2521,10 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, Diag(TildeLoc, diag::err_destructor_tilde_scope) << FixItHint::CreateRemoval(TildeLoc) << FixItHint::CreateInsertion(Tok.getLocation(), "~"); + + // Temporarily enter the scope for the rest of this function. + if (Actions.ShouldEnterDeclaratorScope(getCurScope(), SS)) + DeclScopeObj.EnterDeclaratorScope(); } // Parse the class-name (or template-name in a simple-template-id). |