[PATCH] c++, libstc++: Bump __cpp_impl_reflection and __cpp_lib_reflection

Jakub Jelinek jakub@redhat.com
Wed Apr 22 10:23:29 GMT 2026


Hi!

Both __cpp_impl_reflection and __cpp_lib_reflection were increased from
202506L to 202603L post Croydon, I assume to show that P3795R2 (maybe some
issues too) have been implemented.
Now, we do implement P3795R2 except for the is_applicable_type,
is_nothrow_applicable_type and apply_result metafunctions, but Jonathan says
there is agreement in LWG that to test for availability of those one should
test __cpp_lib_reflection >= 202603L && __cpp_lib_apply >= 202603L.

So, this patch bumps both FTMs.

Tested on x86_64-linux, ok for trunk?

2026-04-22  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
	* c-cppbuiltin.cc (c_cpp_builtins): Bump __cpp_impl_reflection value
	from 202506L to 202603L.
gcc/testsuite/
	* g++.dg/DRs/dr2581-2.C: Adjust for __cpp_impl_reflection bump from
	202506L to 202603L.
	* g++.dg/reflect/feat1.C: Likewise.  Also adjust for
	__cpp_lib_reflection bump from 202506L to 202603L.
	* g++.dg/reflect/feat2.C: Likewise.
	* g++.dg/reflect/feat3.C: Likewise.
libstdc++-v3/
	* include/bits/version.def (reflection): Bump 202506L to 202603L
	for both v and in extra_cond.
	* include/bits/version.h: Regenerate.
	* include/std/meta: Compare __glibcxx_reflection against
	202603L rather than 202506L.
	* include/std/type_traits: Compare __cpp_impl_reflection against
	202603L rather than 202506L.
	* src/c++23/std.cc.in: Likewise.  Compare __glibcxx_reflection against
	202603L rather than 202506L.
	* testsuite/20_util/is_structural/value.cc: Compare
	__cpp_impl_reflection against 202603L rather than 202506L.
	* testsuite/20_util/variable_templates_for_traits.cc: Likewise.

--- gcc/c-family/c-cppbuiltin.cc.jj	2026-03-27 10:17:13.713337609 +0100
+++ gcc/c-family/c-cppbuiltin.cc	2026-04-22 11:59:44.926135527 +0200
@@ -1119,7 +1119,7 @@ c_cpp_builtins (cpp_reader *pfile)
 	  cpp_define (pfile, "__cpp_constexpr_virtual_inheritance=202506L");
 	  cpp_define (pfile, "__cpp_expansion_statements=202506L");
 	  if (flag_reflection)
-	    cpp_define (pfile, "__cpp_impl_reflection=202506L");
+	    cpp_define (pfile, "__cpp_impl_reflection=202603L");
 	  else
 	    cpp_warn (pfile, "__cpp_impl_reflection");
 	}
--- gcc/testsuite/g++.dg/DRs/dr2581-2.C.jj	2026-03-27 10:17:15.320311386 +0100
+++ gcc/testsuite/g++.dg/DRs/dr2581-2.C	2026-04-22 12:02:27.265362686 +0200
@@ -64,7 +64,7 @@
 #define __cpp_impl_coroutine 201902L		// { dg-error "'__cpp_impl_coroutine' redefined" "" { target c++20 } }
 #define __cpp_impl_destroying_delete 201806L	// { dg-error "'__cpp_impl_destroying_delete' redefined" "" { target c++20 } }
 #define __cpp_impl_three_way_comparison 201907L	// { dg-error "'__cpp_impl_three_way_comparison' redefined" "" { target c++20 } }
-#define __cpp_impl_reflection 202506L		// { dg-error "'__cpp_impl_reflection' redefined" "" { target c++26 } }
+#define __cpp_impl_reflection 202603L		// { dg-error "'__cpp_impl_reflection' redefined" "" { target c++26 } }
 #define __cpp_implicit_move 202207L		// { dg-error "'__cpp_implicit_move' redefined" "" { target c++23 } }
 #define __cpp_inheriting_constructors 201511L	// { dg-error "'__cpp_inheriting_constructors' redefined" "" { target c++20 } }
 #define __cpp_init_captures 201803L		// { dg-error "'__cpp_init_captures' redefined" "" { target c++14 } }
--- gcc/testsuite/g++.dg/reflect/feat1.C.jj	2026-03-27 10:17:16.125298250 +0100
+++ gcc/testsuite/g++.dg/reflect/feat1.C	2026-04-22 12:00:26.919418259 +0200
@@ -4,14 +4,14 @@
 
 #ifndef __cpp_impl_reflection
 #  error "__cpp_impl_reflection"
-#elif __cpp_impl_reflection != 202506
-#  error "__cpp_impl_reflection != 202506"
+#elif __cpp_impl_reflection != 202603
+#  error "__cpp_impl_reflection != 202603"
 #endif
 
 #include <meta>
 
 #ifndef __cpp_lib_reflection
 #  error "__cpp_lib_reflection"
-#elif __cpp_lib_reflection != 202506
-#  error "__cpp_lib_reflection != 202506"
+#elif __cpp_lib_reflection != 202603
+#  error "__cpp_lib_reflection != 202603"
 #endif
--- gcc/testsuite/g++.dg/reflect/feat2.C.jj	2026-03-27 10:17:16.125298250 +0100
+++ gcc/testsuite/g++.dg/reflect/feat2.C	2026-04-22 12:00:42.738148067 +0200
@@ -6,8 +6,8 @@
 
 #ifndef __cpp_lib_reflection
 #  error "__cpp_lib_reflection"
-#elif __cpp_lib_reflection != 202506
-#  error "__cpp_lib_reflection != 202506"
+#elif __cpp_lib_reflection != 202603
+#  error "__cpp_lib_reflection != 202603"
 #endif
 
 #ifndef __cpp_lib_define_static
--- gcc/testsuite/g++.dg/reflect/feat3.C.jj	2026-03-27 10:17:16.125298250 +0100
+++ gcc/testsuite/g++.dg/reflect/feat3.C	2026-04-22 12:01:46.374061130 +0200
@@ -6,8 +6,8 @@
 
 #ifndef __cpp_lib_reflection
 #  error "__cpp_lib_reflection"
-#elif __cpp_lib_reflection != 202506
-#  error "__cpp_lib_reflection != 202506"
+#elif __cpp_lib_reflection != 202603
+#  error "__cpp_lib_reflection != 202603"
 #endif
 
 #ifndef __cpp_lib_define_static
--- libstdc++-v3/include/bits/version.def.jj	2026-04-14 21:13:35.039460718 +0200
+++ libstdc++-v3/include/bits/version.def	2026-04-22 12:03:42.709074062 +0200
@@ -2337,9 +2337,9 @@ ftms = {
 ftms = {
   name = reflection;
   values = {
-    v = 202506;
+    v = 202603;
     cxxmin = 26;
-    extra_cond = "__cpp_impl_reflection >= 202506L";
+    extra_cond = "__cpp_impl_reflection >= 202603L";
     cxx11abi = yes;
   };
 };
--- libstdc++-v3/include/bits/version.h.jj	2026-04-14 21:13:35.039460718 +0200
+++ libstdc++-v3/include/bits/version.h	2026-04-22 12:03:49.126595150 +0200
@@ -2602,10 +2602,10 @@
 #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 (__cplusplus >  202302L) && _GLIBCXX_USE_CXX11_ABI && (__cpp_impl_reflection >= 202603L)
+#  define __glibcxx_reflection 202603L
 #  if defined(__glibcxx_want_all) || defined(__glibcxx_want_reflection)
-#   define __cpp_lib_reflection 202506L
+#   define __cpp_lib_reflection 202603L
 #  endif
 # endif
 #endif /* !defined(__cpp_lib_reflection) */
--- libstdc++-v3/include/std/meta.jj	2026-04-21 18:24:44.122033404 +0200
+++ libstdc++-v3/include/std/meta	2026-04-22 12:04:19.089452664 +0200
@@ -37,7 +37,7 @@
 #define __glibcxx_want_define_static
 #include <bits/version.h>
 
-#if __glibcxx_reflection >= 202506L // C++ >= 26 && __cpp_impl_reflection
+#if __glibcxx_reflection >= 202603L // C++ >= 26 && __cpp_impl_reflection
 
 #include <array>
 #include <initializer_list>
--- libstdc++-v3/include/std/type_traits.jj	2026-04-08 15:33:26.695042703 +0200
+++ libstdc++-v3/include/std/type_traits	2026-04-22 12:04:59.783757579 +0200
@@ -755,7 +755,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     : public false_type { };
 #endif
 
-#if __cpp_impl_reflection >= 202506L // C++ >= 26
+#if __cpp_impl_reflection >= 202603L // C++ >= 26
   /// is_reflection
   template<typename _Tp>
     struct is_reflection
@@ -844,7 +844,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct is_fundamental
     : public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
 		   is_null_pointer<_Tp>
-#if __cpp_impl_reflection >= 202506L
+#if __cpp_impl_reflection >= 202603L
 		   , is_reflection<_Tp>
 #endif
 		   >::type
@@ -3561,7 +3561,7 @@ template <typename _Tp>
     is_member_function_pointer<_Tp>::value;
 #endif
 
-#if __cpp_impl_reflection >= 202506L // C++ >= 26
+#if __cpp_impl_reflection >= 202603L // C++ >= 26
 template <typename _Tp>
   inline constexpr bool is_reflection_v = false;
 template <>
--- libstdc++-v3/src/c++23/std.cc.in.jj	2026-04-10 08:45:20.742811345 +0200
+++ libstdc++-v3/src/c++23/std.cc.in	2026-04-22 12:05:31.902208977 +0200
@@ -2083,7 +2083,7 @@ export namespace std::pmr
 }
 
 // <meta>
-#if __glibcxx_reflection >= 202506L
+#if __glibcxx_reflection >= 202603L
 export namespace std
 {
 #if __has_builtin(__builtin_is_string_literal)
@@ -3572,7 +3572,7 @@ export namespace std
   using std::is_implicit_lifetime;
   using std::is_implicit_lifetime_v;
 #endif
-#if __cpp_impl_reflection >= 202506L
+#if __cpp_impl_reflection >= 202603L
   using std::is_reflection;
   using std::is_reflection_v;
 #endif
--- libstdc++-v3/testsuite/20_util/is_structural/value.cc.jj	2026-04-03 20:51:17.921877231 +0200
+++ libstdc++-v3/testsuite/20_util/is_structural/value.cc	2026-04-22 12:06:06.519617691 +0200
@@ -24,7 +24,7 @@ void test01()
   static_assert(test_category<is_structural, int (ClassType::*)>(true), "");
   static_assert(test_category<is_structural, int (ClassType::*) (int)>(true), "");
   static_assert(test_category<is_structural, std::nullptr_t>(true), "");
-#if __cpp_impl_reflection >= 202506L
+#if __cpp_impl_reflection >= 202603L
   static_assert(test_category<is_structural, decltype(^^::)>(true), "");
 #endif
   static_assert(test_category<is_structural, int&>(true), "");
--- libstdc++-v3/testsuite/20_util/variable_templates_for_traits.cc.jj	2026-04-08 07:49:13.479066346 +0200
+++ libstdc++-v3/testsuite/20_util/variable_templates_for_traits.cc	2026-04-22 12:06:28.514242009 +0200
@@ -331,7 +331,7 @@ static_assert(is_convertible_v<int&, con
 static_assert(!is_convertible_v<const int&, int&>
 	      && !is_convertible<const int&, int&>::value, "");
 
-#if __cpp_impl_reflection >= 202506L
+#if __cpp_impl_reflection >= 202603L
 static_assert(is_reflection_v<decltype(^^int)>
 	      && is_reflection<decltype(^^int)>::value, "");
 static_assert(!is_reflection_v<int> && !is_reflection<int>::value, "");

	Jakub



More information about the Libstdc++ mailing list