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
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index dad1f0d..55f9245 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -219,13 +219,19 @@
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)) {