diff options
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index c036640b71..2689859e8e 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -1488,7 +1488,7 @@ public: // FIXME: Missing: __real__/__imag__, array subscript of vector, // member of vector, ImplicitValueInitExpr, - // conditional ?:, comma + // conditional ?: }; } // end anonymous namespace @@ -1577,6 +1577,18 @@ bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) { } bool FloatExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) { + if (E->getOpcode() == BinaryOperator::Comma) { + if (!EvaluateFloat(E->getRHS(), Result, Info)) + return false; + + // If we can't evaluate the LHS, it might have side effects; + // conservatively mark it. + if (!E->getLHS()->isEvaluatable(Info.Ctx)) + Info.EvalResult.HasSideEffects = true; + + return true; + } + // FIXME: Diagnostics? I really don't understand how the warnings // and errors are supposed to work. APFloat RHS(0.0); |