]> granicus.if.org Git - clang/commitdiff
Don't warn about use of 'final' in ill-formed C++98 code which didn't use
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 15 Oct 2011 03:38:41 +0000 (03:38 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 15 Oct 2011 03:38:41 +0000 (03:38 +0000)
'final', and don't accept (then silently discard) braced init lists in C++98
new-expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142048 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseExprCXX.cpp

index 4339047f1f16e331f85c57eae4637d3e16149b7d..358aec62ecfbacc1acbcd9997d0c75ef808d93a3 100644 (file)
@@ -2080,11 +2080,12 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
       Ident_override = &PP.getIdentifierTable().get("override");
     }
       
-    if (II == Ident_final)
+    if (II == Ident_final) {
       FinalLoc = ConsumeToken();
 
-    if (!getLang().CPlusPlus0x) 
-      Diag(FinalLoc, diag::ext_override_control_keyword) << "final";
+      if (!getLang().CPlusPlus0x) 
+        Diag(FinalLoc, diag::ext_override_control_keyword) << "final";
+    }
   }
 
   if (Tok.is(tok::colon)) {
index 60166e880c04f7872d7a4b409bcc36465df7bd22..d079aa1d3df611c02221e6f086506dea73ed040a 100644 (file)
@@ -2103,7 +2103,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
       SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true);
       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.
     ParseBraceInitializer();
   }