[libcxx-commits] [libcxx] [libcxx][test] Stop testing signaling NaN in the constexpr comparison functions (PR #222542)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 20 02:21:28 PDT 2026


frederick-vs-ja wrote:

> One question about the suggested guard: since `TestFloat::operator()` is `TEST_CONSTEXPR_CXX23` and constant evaluation only happens via `static_assert(test())` under `TEST_STD_VER >= 23`, `TEST_STD_AT_LEAST_23_OR_RUNTIME_EVALUATED` evaluates to `true` in every context where this code actually runs — so the sNaN assertions would still execute during C++23 constant evaluation, which is exactly what MSVC's implementation rejects (#222431).

Looks like that I suggested a wrong condition. My thought was that we should skip nothing before C++23, while skip sNaN comparisons for constant evaluation since C++23. `if (!TEST_IS_CONSTANT_EVALUATED)` should be correct.

> or `if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)` if we believe P3899 makes this well-defined in C++26 constant evaluation — though as @jcranmer-intel noted, it's unclear whether P3899's sNaN rules extend to these library comparison functions.

I don't exactly know what you meant by these.

First, IIUC P3899 didn't touch comparisons at all. Second, if we consider P3899's sNaN rules to be extended to library comparison functions (which actually requires a follow-up Defect Report, IIUC), then it would be clear that sNaN comparisons render constant evaluation fail. Third, P3899 is accepted as Defect Report, so it's applied to old modes.

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


More information about the libcxx-commits mailing list