PR11391: Don't try to evaluate the LHS of a _Complex assignment as an rvalue.

llvm-svn: 144799
This commit is contained in:
Richard Smith 2011-11-16 17:22:48 +00:00
parent 0ca7ce389c
commit 10f4d06b81
2 changed files with 8 additions and 0 deletions

View File

@ -3695,10 +3695,14 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
}
bool ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (E->isPtrMemOp() || E->isAssignmentOp())
return ExprEvaluatorBaseTy::VisitBinaryOperator(E);
if (E->getOpcode() == BO_Comma) {
VisitIgnoredValue(E->getLHS());
return Visit(E->getRHS());
}
if (!Visit(E->getLHS()))
return false;

View File

@ -108,3 +108,7 @@ int literalVsNull2 = 0 == "foo";
// PR11385.
int castViaInt[*(int*)(unsigned long)"test"]; // expected-error {{variable length array}}
// PR11391.
struct PR11391 { _Complex float f; } pr11391;
EVAL_EXPR(42, __builtin_constant_p(pr11391.f = 1))