https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98829
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Your custom quiet NaN is not a quiet NaN, but signaling NaN. And, as documented, -fno-signaling-nans is the default. If you change your custom signaling NaN into a quiet NaN, static constexpr std::uint64_t kCustomNaN = 0x7ff8000000000000 | kMagicNumber; or if you compile with -fsignaling-nans, this works fine, so I'd say this is just a user error.