]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Disable __cpp_lib_reflection for old CXX ABI
authorJakub Jelinek <jakub@redhat.com>
Tue, 20 Jan 2026 11:01:07 +0000 (12:01 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 20 Jan 2026 11:01:07 +0000 (12:01 +0100)
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.

libstdc++-v3/include/bits/version.def
libstdc++-v3/include/bits/version.h

index 175e695a96db1040c2e1a39e3bdec4984ec37fff..8bb3e8d185f39be9d4b3afde9ac030779f9ce92f 100644 (file)
@@ -2259,6 +2259,7 @@ ftms = {
     v = 202506;
     cxxmin = 26;
     extra_cond = "__cpp_impl_reflection >= 202506L";
+    cxx11abi = yes;
   };
 };
 
index 020c256ca0cad0a3a695c835e00e8781e45ae4a5..107b19002d7a3fcf7d5b9bfceaa53a038ed8a13c 100644 (file)
 #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
 #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