diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 16 | ||||
-rw-r--r-- | lib/Parse/Parser.cpp | 3 |
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 730c345d80..e7d4ac7c37 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1704,12 +1704,16 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, } // Access declarations. + bool MalformedTypeSpec = false; if (!TemplateInfo.Kind && - (Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) && - !TryAnnotateCXXScopeToken() && - Tok.is(tok::annot_cxxscope)) { - bool isAccessDecl = false; - if (NextToken().is(tok::identifier)) + (Tok.is(tok::identifier) || Tok.is(tok::coloncolon))) { + if (TryAnnotateCXXScopeToken()) + MalformedTypeSpec = true; + + bool isAccessDecl; + if (Tok.isNot(tok::annot_cxxscope)) + isAccessDecl = false; + else if (NextToken().is(tok::identifier)) isAccessDecl = GetLookAheadToken(2).is(tok::semi); else isAccessDecl = NextToken().is(tok::kw_operator); @@ -1806,6 +1810,8 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // Parse the common declaration-specifiers piece. ParsingDeclSpec DS(*this, TemplateDiags); DS.takeAttributesFrom(attrs); + if (MalformedTypeSpec) + DS.SetTypeSpecError(); ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC_class, &CommonLateParsedAttrs); diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index e406b184a7..955f4558f8 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1420,8 +1420,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { /// TryAnnotateScopeToken - Like TryAnnotateTypeOrScopeToken but only /// annotates C++ scope specifiers and template-ids. This returns -/// true if the token was annotated or there was an error that could not be -/// recovered from. +/// true if there was an error that could not be recovered from. /// /// Note that this routine emits an error if you call it with ::new or ::delete /// as the current tokens, so only call it in contexts where these are invalid. |