[clang] [C++23] [CLANG] Adding C++23 constexpr math functions: fmin and frexp. (PR #88978)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 22:41:35 PDT 2024


================
@@ -2922,7 +2922,7 @@ static bool handleFloatFloatBinOp(EvalInfo &Info, const BinaryOperator *E,
   //   If during the evaluation of an expression, the result is not
   //   mathematically defined [...], the behavior is undefined.
   // FIXME: C++ rules require us to not conform to IEEE 754 here.
-  if (LHS.isNaN()) {
+  if (!Info.getLangOpts().CPlusPlus23 && LHS.isNaN()) {
----------------
cor3ntin wrote:

> My understanding of the intended design was that operations producing NaNs from non-NaNs in C++

What is "operation" here? NaN in arithmetics / conversions / other core language etc are one thing, but
when calling a function which is specifically specified to produce NaN in some cases... it's very unclear to me that the program should be invalid.

If that's the intent, is there anywhere where it would be documented?


https://github.com/llvm/llvm-project/pull/88978


More information about the cfe-commits mailing list