[cfe-commits] r143250 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/Sema/const-eval.c
Richard Smith
richard-llvm at metafoo.co.uk
Fri Oct 28 16:26:52 PDT 2011
Author: rsmith
Date: Fri Oct 28 18:26:52 2011
New Revision: 143250
URL: http://llvm.org/viewvc/llvm-project?rev=143250&view=rev
Log:
Fix assertion in constant expression evaluation. The LHS of a floating-point
binary operator isn't an rvalue if it's an assignment operator.
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=143250&r1=143249&r2=143250&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Oct 28 18:26:52 2011
@@ -2492,8 +2492,8 @@
return Visit(E->getRHS());
}
- // We can't evaluate pointer-to-member operations.
- if (E->isPtrMemOp())
+ // We can't evaluate pointer-to-member operations or assignments.
+ if (E->isPtrMemOp() || E->isAssignmentOp())
return false;
// FIXME: Diagnostics? I really don't understand how the warnings
Modified: cfe/trunk/test/Sema/const-eval.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/const-eval.c?rev=143250&r1=143249&r2=143250&view=diff
==============================================================================
--- cfe/trunk/test/Sema/const-eval.c (original)
+++ cfe/trunk/test/Sema/const-eval.c Fri Oct 28 18:26:52 2011
@@ -86,3 +86,5 @@
double _Complex P;
float _Complex P2 = 3.3f + P;
}
+
+double d = (d = 0.0); // expected-error {{not a compile-time constant}}
More information about the cfe-commits
mailing list