diff options
-rw-r--r-- | lib/AST/ExprConstant.cpp | 4 | ||||
-rw-r--r-- | test/Sema/const-eval.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 89bcacf2bb..6e2e15c6cb 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -2492,8 +2492,8 @@ bool FloatExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) { 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 diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c index bdb40ae54b..6dcc6db765 100644 --- a/test/Sema/const-eval.c +++ b/test/Sema/const-eval.c @@ -86,3 +86,5 @@ void rdar8875946() { double _Complex P; float _Complex P2 = 3.3f + P; } + +double d = (d = 0.0); // expected-error {{not a compile-time constant}} |