Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 2e0a715

Browse files
committed
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97462 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent aac571c commit 2e0a715

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
865865
DS.SetTypeSpecError();
866866
goto DoneWithDeclSpec;
867867
}
868+
if (Tok.is(tok::coloncolon)) // ::new or ::delete
869+
goto DoneWithDeclSpec;
868870
continue;
869871

870872
case tok::annot_cxxscope: {

test/Parser/cxx-decl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@ struct test4 {
5858
int y;
5959
int z // expected-error {{expected ';' at end of declaration list}}
6060
};
61+
62+
// PR5825
63+
struct test5 {};
64+
::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}}

0 commit comments

Comments
 (0)