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

Jakub Jelinek jakub@redhat.com
Wed Apr 22 10:44:40 GMT 2026


On Wed, Apr 22, 2026 at 11:36:01AM +0100, Jonathan Wakely wrote:
> > > --- 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
> >
> > I don't think we need to change any of the #if checks below here,
> > because nothing in those #if groups was changed by P3795. The checks
> > in e.g. <type_traits> and the tests are saying "is the value of the
> > macro high enough that we should provide these features?" and that's
> > true for the old value.
> 
> The #if in <meta> guards the addition of the annotations vector to
> data_member_spec, so checking the new value there makes sense.

Yeah, for <meta> sure, and I think for std.cc.in too (otherwise
e.g. std::meta::current_namespace wouldn't be available).
For <type_traits> and the two libstdc++ tests, I agree we can keep comparing
against the old value.  Actually, for the second case in std.cc.in (whether
is_reflection_v is available) we can keep using the existing value too.

So here is an updated patch:

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.
	* src/c++23/std.cc.in: 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/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)


	Jakub



More information about the Libstdc++ mailing list