https://gcc.gnu.org/g:a4954130d43d478a23ec8b65f5d861167935d77a

commit r15-5764-ga4954130d43d478a23ec8b65f5d861167935d77a
Author: Marek Polacek <pola...@redhat.com>
Date:   Thu Nov 28 12:07:00 2024 -0500

    c++: define __cpp_pack_indexing [PR113798]
    
    Forgot to do this in my original patch.
    
            PR c++/113798
    
    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.
    
    Reviewed-by: Jakub Jelinek <ja...@redhat.com>

Diff:
---
 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 c354c794b55e..195f8ae5e40b 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 c387a7dfe609..d74ff0e427bd 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

Reply via email to