Fix an assertion-on-error during tentative constructor parsing by
propagating error conditions out of the various annotate-me-a-snowflake
routines. Generally (but not universally) removes redundant diagnostics
as well as, you know, not crashing on bad code. On the other hand,
I have just signed myself up to fix fiddly parser errors for the next
week. Again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97221 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index f69740b..af91021 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -626,6 +626,8 @@
Next.is(tok::l_paren)) {
// If TryAnnotateTypeOrScopeToken annotates the token, tail recurse.
if (TryAnnotateTypeOrScopeToken())
+ return ExprError();
+ if (!Tok.is(tok::identifier))
return ParseCastExpression(isUnaryExpression, isAddressOfOperand);
}
}
@@ -790,7 +792,7 @@
if (SavedKind == tok::kw_typename) {
// postfix-expression: typename-specifier '(' expression-list[opt] ')'
- if (!TryAnnotateTypeOrScopeToken())
+ if (TryAnnotateTypeOrScopeToken())
return ExprError();
}
@@ -852,6 +854,8 @@
// ::foo::bar -> global qualified name etc. If TryAnnotateTypeOrScopeToken
// annotates the token, tail recurse.
if (TryAnnotateTypeOrScopeToken())
+ return ExprError();
+ if (!Tok.is(tok::coloncolon))
return ParseCastExpression(isUnaryExpression, isAddressOfOperand);
// ::new -> [C++] new-expression