[cfe-commits] r144799 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/Sema/const-eval.c
Richard Smith
richard-llvm at metafoo.co.uk
Wed Nov 16 09:22:49 PST 2011
Author: rsmith
Date: Wed Nov 16 11:22:48 2011
New Revision: 144799
URL: http://llvm.org/viewvc/llvm-project?rev=144799&view=rev
Log:
PR11391: Don't try to evaluate the LHS of a _Complex assignment as an rvalue.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/Sema/const-eval.c
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=144799&r1=144798&r2=144799&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Nov 16 11:22:48 2011
@@ -3695,10 +3695,14 @@
}
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;
Modified: cfe/trunk/test/Sema/const-eval.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/const-eval.c?rev=144799&r1=144798&r2=144799&view=diff
==============================================================================
--- cfe/trunk/test/Sema/const-eval.c (original)
+++ cfe/trunk/test/Sema/const-eval.c Wed Nov 16 11:22:48 2011
@@ -108,3 +108,7 @@
// 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))
More information about the cfe-commits
mailing list