aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseTemplate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Parse/ParseTemplate.cpp')
-rw-r--r--clang/lib/Parse/ParseTemplate.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index 9e68c4a..e6ce30a 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/lib/Parse/ParseTemplate.cpp
@@ -855,8 +855,12 @@ bool Parser::ParseGreaterThanInTemplateList(SourceLocation &RAngleLoc,
RemainingToken == tok::greater && PP.IsPreviousCachedToken(PrevTok)) {
PrevTok.setKind(RemainingToken);
PrevTok.setLength(1);
- Token NewToks[] = {PrevTok, Tok};
- PP.ReplacePreviousCachedToken(NewToks);
+ // Break tok::greatergreater into two tok::greater but only add the second
+ // one in case the client asks to consume the last token.
+ if (ConsumeLastToken)
+ PP.ReplacePreviousCachedToken({PrevTok, Tok});
+ else
+ PP.ReplacePreviousCachedToken({PrevTok});
}
if (!ConsumeLastToken) {