[cfe-commits] r97462 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/cxx-decl.cpp
John McCall
rjmccall at apple.com
Mon Mar 1 10:20:47 PST 2010
Author: rjmccall
Date: Mon Mar 1 12:20:46 2010
New Revision: 97462
URL: http://llvm.org/viewvc/llvm-project?rev=97462&view=rev
Log:
Don't infinite-loop if TryAnnotateCXXScopeToken fails to annotate but doesn't
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.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/cxx-decl.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=97462&r1=97461&r2=97462&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Mar 1 12:20:46 2010
@@ -865,6 +865,8 @@
DS.SetTypeSpecError();
goto DoneWithDeclSpec;
}
+ if (Tok.is(tok::coloncolon)) // ::new or ::delete
+ goto DoneWithDeclSpec;
continue;
case tok::annot_cxxscope: {
Modified: cfe/trunk/test/Parser/cxx-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-decl.cpp?rev=97462&r1=97461&r2=97462&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx-decl.cpp Mon Mar 1 12:20:46 2010
@@ -58,3 +58,7 @@
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}}
More information about the cfe-commits
mailing list