[gcc r16-6917] libstdc++: Disable __cpp_lib_reflection for old CXX ABI
Jakub Jelinek
jakub@gcc.gnu.org
Tue Jan 20 11:03:43 GMT 2026
https://gcc.gnu.org/g:23cd6f3bcb494606afe82a490b10f64f660d8143
commit r16-6917-g23cd6f3bcb494606afe82a490b10f64f660d8143
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Jan 20 12:01:07 2026 +0100
libstdc++: Disable __cpp_lib_reflection for old CXX ABI
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 use C++26 features with the ABI that isn't
even compatible with C++11.
2026-01-20 Jakub Jelinek <jakub@redhat.com>
* include/bits/version.def (reflection): Add cxx11abi = yes;.
* include/bits/version.h: Regenerate.
Diff:
---
libstdc++-v3/include/bits/version.def | 1 +
libstdc++-v3/include/bits/version.h | 20 ++++++++++----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index 175e695a96db..8bb3e8d185f3 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -2259,6 +2259,7 @@ ftms = {
v = 202506;
cxxmin = 26;
extra_cond = "__cpp_impl_reflection >= 202506L";
+ cxx11abi = yes;
};
};
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index 020c256ca0ca..107b19002d7a 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -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
More information about the Libstdc++-cvs
mailing list