Don't warn about use of 'final' in ill-formed C++98 code which didn't use

'final', and don't accept (then silently discard) braced init lists in C++98
new-expressions.

llvm-svn: 142048
This commit is contained in:
Richard Smith 2011-10-15 03:38:41 +00:00
parent 27ef75b0be
commit 2db9652b5a
2 changed files with 5 additions and 4 deletions

View File

@ -2080,12 +2080,13 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
Ident_override = &PP.getIdentifierTable().get("override"); Ident_override = &PP.getIdentifierTable().get("override");
} }
if (II == Ident_final) if (II == Ident_final) {
FinalLoc = ConsumeToken(); FinalLoc = ConsumeToken();
if (!getLang().CPlusPlus0x) if (!getLang().CPlusPlus0x)
Diag(FinalLoc, diag::ext_override_control_keyword) << "final"; Diag(FinalLoc, diag::ext_override_control_keyword) << "final";
} }
}
if (Tok.is(tok::colon)) { if (Tok.is(tok::colon)) {
ParseBaseClause(TagDecl); ParseBaseClause(TagDecl);

View File

@ -2103,7 +2103,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true); SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true);
return ExprError(); return ExprError();
} }
} else if (Tok.is(tok::l_brace)) { } else if (Tok.is(tok::l_brace) && getLang().CPlusPlus0x) {
// FIXME: Have to communicate the init-list to ActOnCXXNew. // FIXME: Have to communicate the init-list to ActOnCXXNew.
ParseBraceInitializer(); ParseBraceInitializer();
} }