https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88173
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> --- -fno-trapping-math is relevant. Gcc believes that comparing QNaN to something requires setting a flag in fenv, which can only be done at runtime. I expect that's wrong, or almost any operation on double would not be constexpr because of the inexact flag (that would have been a consistent choice, but most people don't care about fenv...).