Fix handling of the GNU "t ? : f" extension to the conditional
operator in C++, and verify that template instantiation for the
condition operator does the right thing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72127 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 6bafdf2..2df76a2 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -828,16 +828,16 @@
// casts should be wrapped by ImplicitCastExprs. There's just the special
// case involving throws to work out.
const ConditionalOperator *Cond = cast<ConditionalOperator>(this);
- Expr *LHS = Cond->getLHS();
- Expr *RHS = Cond->getRHS();
+ Expr *True = Cond->getTrueExpr();
+ Expr *False = Cond->getFalseExpr();
// C++0x 5.16p2
// If either the second or the third operand has type (cv) void, [...]
// the result [...] is an rvalue.
- if (LHS->getType()->isVoidType() || RHS->getType()->isVoidType())
+ if (True->getType()->isVoidType() || False->getType()->isVoidType())
return LV_InvalidExpression;
// Both sides must be lvalues for the result to be an lvalue.
- if (LHS->isLvalue(Ctx) != LV_Valid || RHS->isLvalue(Ctx) != LV_Valid)
+ if (True->isLvalue(Ctx) != LV_Valid || False->isLvalue(Ctx) != LV_Valid)
return LV_InvalidExpression;
// That's it.