[PATCH] libstdc++: Disable __cpp_lib_reflection for old CXX ABI
Jonathan Wakely
jwakely@redhat.com
Tue Jan 20 10:11:10 GMT 2026
On Tue, 20 Jan 2026 at 00:52, Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> Reflection currently doesn't work with -D_GLIBCXX_USE_CXX11_ABI=0.
> The problem is that std::meta::exception currently uses under the
> hood std::string and std::u8string and those aren't constexpr in
> the old ABI.
> While those members are in the standard exposition-only and so
> we could make it to work by writing a custom class template that
> just remembers const char{,8_t} * and size_t, there shouldn't be
> many people trying to mix ABI incompatible even with C++11 together
> with C++26.
Maybe "shouldn't be many people trying to use C++26 features with the
ABI that isn't even compatible with C++11"?
OK for trunk like that, thanks.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2026-01-20 Jakub Jelinek <jakub@redhat.com>
>
> * include/bits/version.def (reflection): Add cxx11abi = yes;.
> * include/bits/version.h: Regenerate.
>
> --- libstdc++-v3/include/bits/version.def.jj 2026-01-15 16:33:47.022097704 +0100
> +++ libstdc++-v3/include/bits/version.def 2026-01-19 17:28:16.214806742 +0100
> @@ -2259,6 +2259,7 @@ ftms = {
> v = 202506;
> cxxmin = 26;
> extra_cond = "__cpp_impl_reflection >= 202506L";
> + cxx11abi = yes;
> };
> };
>
> --- libstdc++-v3/include/bits/version.h.jj 2026-01-15 16:33:47.022097704 +0100
> +++ libstdc++-v3/include/bits/version.h 2026-01-19 17:28:22.844417523 +0100
> @@ -2526,6 +2526,16 @@
> #endif /* !defined(__cpp_lib_philox_engine) */
> #undef __glibcxx_want_philox_engine
>
> +#if !defined(__cpp_lib_reflection)
> +# if (__cplusplus > 202302L) && _GLIBCXX_USE_CXX11_ABI && (__cpp_impl_reflection >= 202506L)
> +# define __glibcxx_reflection 202506L
> +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_reflection)
> +# define __cpp_lib_reflection 202506L
> +# endif
> +# endif
> +#endif /* !defined(__cpp_lib_reflection) */
> +#undef __glibcxx_want_reflection
> +
> #if !defined(__cpp_lib_is_implicit_lifetime)
> # if (__cplusplus >= 202100L) && (__has_builtin(__builtin_is_implicit_lifetime))
> # define __glibcxx_is_implicit_lifetime 202302L
> @@ -2536,14 +2546,4 @@
> #endif /* !defined(__cpp_lib_is_implicit_lifetime) */
> #undef __glibcxx_want_is_implicit_lifetime
>
> -#if !defined(__cpp_lib_reflection)
> -# if (__cplusplus > 202302L) && (__cpp_impl_reflection >= 202506L)
> -# define __glibcxx_reflection 202506L
> -# if defined(__glibcxx_want_all) || defined(__glibcxx_want_reflection)
> -# define __cpp_lib_reflection 202506L
> -# endif
> -# endif
> -#endif /* !defined(__cpp_lib_reflection) */
> -#undef __glibcxx_want_reflection
> -
> #undef __glibcxx_want_all
>
> Jakub
>
More information about the Libstdc++
mailing list