[clang] [clang][C23] Allow NaN in constant evaluation (PR #167892)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 17 09:12:45 PST 2025


================
@@ -222,6 +222,8 @@ C23 Feature Support
   the same translation unit but from different types.
 - ``-MG`` now silences the "file not found" errors with ``#embed`` when
   scanning for dependencies and encountering an unknown file. #GH165632
+- Allow NaN in constant expression evaluation to maintain consistency with
----------------
AaronBallman wrote:

I don't know what to expect out of the committee, but allowing (quiet) NaN in constant expressions makes a lot of sense to me, at least for IEEE math. The whole point to a quiet NaN (AIUI) is so that you can let them flow through a mathematical calculation to the end result. And there's no reason to believe that end result is unexpected, either; if it was the case, then there would be no push for constexpr support for the library functions which produce those values.

Signalling NaN is the one where you want to be alerted as soon as the calculation ends up with that result. That one makes a lot of sense to me to fail immediately in constant expressions.

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


More information about the cfe-commits mailing list