https://gcc.gnu.org/g:e3b888b9c0d547223e569ef8d79e994b9232c543
commit r17-5545-ge3b888b9c0d547223e569ef8d79e994b9232c543 Author: Iain Sandoe <[email protected]> Date: Sat Aug 8 20:33:27 2026 +0100 libstdc++: Flag Annex G bit from GCC __GCC_IEC_559_COMPLEX. __STDC_IEC_60559_COMPLEX__ is not a compiler pre-define; it is provided by glibc but not necessarily by other libc implementations. However the compiler does support Annex G and emits __GCC_IEC_559_COMPLEX to indicate this (where the value is > 0). Use the compiler's value where __STDC_IEC_60559_COMPLEX__ is absent. libstdc++-v3/ChangeLog: * include/bits/simd_details.h: Use __GCC_IEC_559_COMPLEX to determine IEC60559 complex support. Signed-off-by: Iain Sandoe <[email protected]> Diff: --- libstdc++-v3/include/bits/simd_details.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/bits/simd_details.h b/libstdc++-v3/include/bits/simd_details.h index 46eab585eb95..29a7195c5393 100644 --- a/libstdc++-v3/include/bits/simd_details.h +++ b/libstdc++-v3/include/bits/simd_details.h @@ -532,8 +532,13 @@ namespace simd // C Annex G defines the behavior of complex<T> where T is IEC60559 floating-point. If // __STDC_IEC_60559_COMPLEX__ is defined then Annex G is implemented - and simd<complex> - // will do so as well. However, Clang never defines the macro. -#if defined __STDC_IEC_60559_COMPLEX__ || defined __STDC_IEC_559_COMPLEX__ || defined _GLIBCXX_CLANG + // will do so as well. However, __STDC_IEC_60559_COMPLEX__ is defined (if at all) + // by the C library and will typically be absent on non-glibc targets. + // GCC nevertheless implements Annex G and std::complex relies on it; the compiler + // emits __GCC_IEC_559_COMPLEX with value > 0 where it is enabled/valid. + // Clang is flagged to support it unconditionally. +#if defined __STDC_IEC_60559_COMPLEX__ || defined __STDC_IEC_559_COMPLEX__ \ + || (defined __GCC_IEC_559_COMPLEX && __GCC_IEC_559_COMPLEX > 0) || defined _GLIBCXX_CLANG + (1 << 10) #endif #if __SUPPORT_SNAN__
