/// 'throw' assignment-expression[opt]
Parser::ExprResult Parser::ParseThrowExpression() {
assert(Tok.is(tok::kw_throw) && "Not throw!");
-
- ExprResult Expr;
-
SourceLocation ThrowLoc = ConsumeToken(); // Eat the throw token.
+
// If the current token isn't the start of an assignment-expression,
// then the expression is not present. This handles things like:
// "C ? throw : (void)42", which is crazy but legal.
return Actions.ActOnCXXThrow(ThrowLoc);
default:
- Expr = ParseAssignmentExpression();
+ ExprResult Expr = ParseAssignmentExpression();
if (Expr.isInvalid) return Expr;
return Actions.ActOnCXXThrow(ThrowLoc, Expr.Val);
}