TryAnnotateTypeOrScopeToken and TryAnnotateCXXScopeToken can
only be called when they might be needed now, so make them assert
that their current token is :: or identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61662 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 8770bc2..80e25ee 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -637,7 +637,8 @@
return ParseCXXDeleteExpression(true, ColonColonTok.getLocation());
// Turn the qualified name into a annot_qualtypename or annot_cxxscope if
// it would be valid.
- if (TryAnnotateTypeOrScopeToken(&ColonColonTok)) {
+ if ((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) &&
+ TryAnnotateTypeOrScopeToken(&ColonColonTok)) {
// If so, retry (tail recurse).
return ParseCastExpression(isUnaryExpression);
}