https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101795
Bug ID: 101795 Summary: (x > QNaNf) is not a constant expression Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jonas.rahlf.basf at gmail dot com Target Milestone: --- Somehow (x > QNaNf) is not a constant expression, according to g++. I could not find anything in the c++ standard that would support this behaviour. Both clang and MSVC compile (x > QNaNf) as a constant expression. Interestingly, (x == QNaNf) seems to work fine with g++. Example: #include <limits> constexpr bool canCompile = std::numeric_limits<float>::quiet_NaN() > 1; Compiler output: error: '(+QNaNf > 1.0e+0f)' is not a constant expression See also: https://godbolt.org/z/vW651jPYh No extra compile options needed. I noticed this when attempting to compile std::lerp(a,b,NaN) (which is supposed to be constexpr) as a constant expression.