diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-16 17:22:48 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-16 17:22:48 +0000 |
commit | 2ad226bdc847df6b6b6e4f832856478ab63bb3dc (patch) | |
tree | fc2c092df8c2ea90a2e46b070be258be7b4f0492 | |
parent | 261e75bd10198c336aded42f0398a13f7bf88889 (diff) |
PR11391: Don't try to evaluate the LHS of a _Complex assignment as an rvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144799 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ExprConstant.cpp | 4 | ||||
-rw-r--r-- | test/Sema/const-eval.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 699d81715e..f461ec6429 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -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; diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c index 094d1ce716..8904e12bf7 100644 --- a/test/Sema/const-eval.c +++ b/test/Sema/const-eval.c @@ -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)) |