rsmith requested changes to this revision. rsmith added inline comments. This revision now requires changes to proceed.
================ Comment at: clang/lib/AST/ExprConstant.cpp:775-778 + /// Strict floating point is enabled, this inhibits + /// floating ponit constant folding. + bool isStrictFP; + ---------------- This is a property of the operation being constant-evaluated, not of the `EvalInfo`. The way you compute it below will only pick up the right value if the top-level expression in the evaluation happens to be a constrained floating-point evaluation. ================ Comment at: clang/lib/AST/ExprConstant.cpp:13197-13198 assert(E->isRValue() && E->getType()->isRealFloatingType()); + if (Info.isStrictFP) + return false; return FloatExprEvaluator(Info, Result).Visit(E); ---------------- I think we should be able to evaluate (for example) `constexpr float f = 1.0f;` even in a strict FP context. I think only floating point operations that depend on the rounding mode should be disabled, not all floating-point evaluation. Perhaps we should propagate the `FPOptions` into `handleFloatFloatBinOp` and perform the check there, along with any other places that care (I think we probably have some builtins that we can constant-evaluate that care about rounding modes.) You also need to produce a diagnostic when you treat an expression as non-constant -- please read the comment at the top of the file for details. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87528/new/ https://reviews.llvm.org/D87528 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits