https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86974
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- libstdc++ sources do this: #if __has_cpp_attribute(clang::require_constant_initialization) # define __constinit [[clang::require_constant_initialization]] #endif An alternative that doesn't use reserved names and so is suitable for user code would be: #if __cpp_constinit # define CONSTINIT constinit #if __has_cpp_attribute(clang::require_constant_initialization) # define CONSTINIT [[clang::require_constant_initialization]] #elif __GNUC__ >= 10 # define CONSTINIT __constinit #else # define CONSTINIT #endif And then: CONSTINIT S2 objx;