]> granicus.if.org Git - clang/commitdiff
Don't infinite-loop if TryAnnotateCXXScopeToken fails to annotate but doesn't
authorJohn McCall <rjmccall@apple.com>
Mon, 1 Mar 2010 18:20:46 +0000 (18:20 +0000)
committerJohn McCall <rjmccall@apple.com>
Mon, 1 Mar 2010 18:20:46 +0000 (18:20 +0000)
signal an error.  This can happen even when the current token is '::' if
this is a ::new or ::delete expression.

This was an oversight in my recent parser refactor;  fixes PR 5825.

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

lib/Parse/ParseDecl.cpp
test/Parser/cxx-decl.cpp

index 277d69f2cd73293d300faffb04ab05723d0d93ee..4405dcb974a8129291892d8e52ee753e6947991c 100644 (file)
@@ -865,6 +865,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
           DS.SetTypeSpecError();
         goto DoneWithDeclSpec;
       }
+      if (Tok.is(tok::coloncolon)) // ::new or ::delete
+        goto DoneWithDeclSpec;
       continue;
 
     case tok::annot_cxxscope: {
index f37604cc5443dce9fc39d9bb3d495afa88607555..c8f2c0b7690398878f825210029c7a4a8a226898 100644 (file)
@@ -58,3 +58,7 @@ struct test4 {
   int y;
   int z  // expected-error {{expected ';' at end of declaration list}}
 };
+
+// PR5825
+struct test5 {};
+::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}}