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

Cyrus Ding via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 18 00:11:22 PDT 2026


dingcyrus wrote:

Thanks for the reviews!

@philnik777 Understood — I'll mark this as a draft and hold off until the direction on sNaN in these comparison functions is settled (it looks like it's pending clarification after P3899 and the Annex F adaptation work discussed in #222431).

@frederick-vs-ja 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). To actually skip them during constant evaluation while keeping runtime coverage, we'd want either `if (!TEST_IS_CONSTANT_EVALUATED)`, 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.

Happy to implement whichever semantics you prefer once there's a decision on moving forward.

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


More information about the libcxx-commits mailing list