https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108223
Bug ID: 108223
Summary: GCC reject QNaN in constant expressions
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nikolasklauser at berlin dot de
Target Milestone: ---
GCC rejects the following code with "error: '__builtin_fmax(+QNaN, +QNaN)' is
not a constant expression" even though it's perfectly defined behaviour.
test code (Godbolt: https://godbolt.org/z/1hfxM9PEW):
constexpr bool test() {
auto val = __builtin_fmax(__builtin_nan(""), __builtin_nan(""));
return true;
}
static_assert(test());