Parse ?:'s right

llvm-svn: 38961
This commit is contained in:
Chris Lattner 2006-10-06 05:40:05 +00:00
parent d3e9895b9a
commit b5600a6aa8
1 changed files with 2 additions and 2 deletions

View File

@ -305,7 +305,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, unsigned MinPrec) {
ConsumeToken();
// Special case handling for the ternary operator.
ExprResult TernaryMiddle;
ExprResult TernaryMiddle(true);
if (NextTokPrec == prec::Conditional) {
if (Tok.getKind() != tok::colon) {
// Handle this production specially:
@ -361,7 +361,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, unsigned MinPrec) {
assert(NextTokPrec <= ThisPrec && "Recursion didn't work!");
// Combine the LHS and RHS into the LHS (e.g. build AST).
if (NextTokPrec != prec::Conditional)
if (TernaryMiddle.isInvalid)
LHS = Actions.ParseBinOp(OpToken, LHS.Val, RHS.Val);
else
LHS = Actions.ParseConditionalOp(OpToken.getLocation(), ColonLoc,