diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-12-29 19:19:18 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-12-29 19:19:18 +0000 |
commit | e8fb28fa0bb97bead2ac0a7761f3bbf169414326 (patch) | |
tree | bea26d2fc206fb67fade91370de51596968882ae /clang/lib/Parse/ParseExprCXX.cpp | |
parent | 688b6bc2f4e759b1e45512da9d46114c7c55c387 (diff) | |
download | bcm5719-llvm-e8fb28fa0bb97bead2ac0a7761f3bbf169414326.tar.gz bcm5719-llvm-e8fb28fa0bb97bead2ac0a7761f3bbf169414326.zip |
Parse: Ignore '::' in 'struct :: {'
Let's pretend that we didn't see the '::' instead of go on believing
that we've got some anonymous, but globally qualified, struct.
llvm-svn: 224945
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExprCXX.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index dad1f0da2ef..55f9245d586 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -219,13 +219,19 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, if (NextKind == tok::kw_new || NextKind == tok::kw_delete) return false; - // '::' - Global scope qualifier. - if (Actions.ActOnCXXGlobalScopeSpecifier(ConsumeToken(), SS)) - return true; + if (NextKind == tok::l_brace) { + // It is invalid to have :: {, consume the scope qualifier and pretend + // like we never saw it. + Diag(ConsumeToken(), diag::err_expected) << tok::identifier; + } else { + // '::' - Global scope qualifier. + if (Actions.ActOnCXXGlobalScopeSpecifier(ConsumeToken(), SS)) + return true; - CheckForLParenAfterColonColon(); + CheckForLParenAfterColonColon(); - HasScopeSpecifier = true; + HasScopeSpecifier = true; + } } if (Tok.is(tok::kw___super)) { |