diff options
-rw-r--r-- | lib/AST/ExprConstant.cpp | 10 | ||||
-rw-r--r-- | test/Sema/const-eval.c | 1 |
2 files changed, 4 insertions, 7 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index f33827ff7c..bf428aaacc 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -2529,17 +2529,13 @@ bool FloatExprEvaluator::VisitUnaryImag(const UnaryOperator *E) { } bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) { - if (E->getOpcode() == UO_Deref) - return false; - - if (!EvaluateFloat(E->getSubExpr(), Result, Info)) - return false; - switch (E->getOpcode()) { default: return false; case UO_Plus: - return true; + return EvaluateFloat(E->getSubExpr(), Result, Info); case UO_Minus: + if (!EvaluateFloat(E->getSubExpr(), Result, Info)) + return false; Result.changeSign(); return true; } diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c index ee55ca871f..8cfa7ea6f8 100644 --- a/test/Sema/const-eval.c +++ b/test/Sema/const-eval.c @@ -88,6 +88,7 @@ void rdar8875946() { } double d = (d = 0.0); // expected-error {{not a compile-time constant}} +double d2 = ++d; // expected-error {{not a compile-time constant}} int n = 2; int intLvalue[*(int*)((long)&n ?: 1)] = { 1, 2 }; // expected-error {{variable length array}} |