Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clang/lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,14 +1132,14 @@ void Parser::AnnotateExistingDecltypeSpecifier(const DeclSpec &DS,
SourceLocation EndLoc) {
// make sure we have a token we can turn into an annotation token
if (PP.isBacktrackEnabled()) {
PP.RevertCachedTokens(1);
if (DS.getTypeSpecType() == TST_error) {
if (DS.getTypeSpecType() == TST_error)
// We encountered an error in parsing 'decltype(...)' so lets annotate all
// the tokens in the backtracking cache - that we likely had to skip over
// to get to a token that allows us to resume parsing, such as a
// semi-colon.
EndLoc = PP.getLastCachedTokenLocation();
}
else
PP.RevertCachedTokens(1);
} else
PP.EnterToken(Tok, /*IsReinject*/ true);

Expand Down
6 changes: 6 additions & 0 deletions clang/test/Parser/gh114815.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %clang_cc1 -verify %s -std=c++11 -fsyntax-only

#define ID(X) X
extern int ID(decltype);
// expected-error@-1 {{expected '(' after 'decltype'}} \
// expected-error@-1 {{expected unqualified-id}}
Loading