diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-17 22:41:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-17 22:41:34 +0000 |
commit | 94859890384652ed63f7604530f3b988ed223cf4 (patch) | |
tree | 2d1c46c8a32097667dc6cde0d5b9b3626123b44f /lib/Parse/ParseExpr.cpp | |
parent | 200b2921390bd75a659be3c77011e9a5548b7273 (diff) |
Improve recovery when the middle expression of a ternary operator is ill-formed
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExpr.cpp')
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index c3c4b4144a..ec2c5d6b95 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -291,8 +291,10 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { // In particular, the RHS of the '?' is 'expression', not // 'logical-OR-expression' as we might expect. TernaryMiddle = ParseExpression(); - if (TernaryMiddle.isInvalid()) - return move(TernaryMiddle); + if (TernaryMiddle.isInvalid()) { + LHS = ExprError(); + TernaryMiddle = 0; + } } else { // Special case handling of "X ? Y : Z" where Y is empty: // logical-OR-expression '?' ':' conditional-expression [GNU] |