Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?

-- >8 --
Forgot to do this in my original patch.

gcc/c-family/ChangeLog:

        * c-cppbuiltin.cc (c_cpp_builtins): Predefine
        __cpp_pack_indexing=202311L for C++26.

gcc/testsuite/ChangeLog:

        * g++.dg/cpp26/feat-cxx26.C (__cpp_pack_indexing): Add test.
---
 gcc/c-family/c-cppbuiltin.cc            | 1 +
 gcc/testsuite/g++.dg/cpp26/feat-cxx26.C | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index c354c794b55..195f8ae5e40 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1092,6 +1092,7 @@ c_cpp_builtins (cpp_reader *pfile)
          cpp_define (pfile, "__cpp_structured_bindings=202403L");
          cpp_define (pfile, "__cpp_deleted_function=202403L");
          cpp_define (pfile, "__cpp_variadic_friend=202403L");
+         cpp_define (pfile, "__cpp_pack_indexing=202311L");
        }
       if (flag_concepts && cxx_dialect > cxx14)
        cpp_define (pfile, "__cpp_concepts=202002L");
diff --git a/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C 
b/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
index c387a7dfe60..d74ff0e427b 100644
--- a/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
+++ b/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
@@ -622,3 +622,9 @@
 #elif __cpp_variadic_friend != 202403
 #  error "__cpp_variadic_friend != 202403"
 #endif
+
+#ifndef __cpp_pack_indexing
+# error "__cpp_pack_indexing"
+#elif __cpp_pack_indexing != 202311
+#  error "__cpp_pack_indexing != 202311"
+#endif

base-commit: ab2cce593ef6085a5f517cdca2520c5c44acbfad
-- 
2.47.0

Reply via email to