From: Marek Polacek Date: Thu, 28 Nov 2024 17:07:00 +0000 (-0500) Subject: c++: define __cpp_pack_indexing [PR113798] X-Git-Tag: basepoints/gcc-16~3789 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4954130d43d478a23ec8b65f5d861167935d77a;p=thirdparty%2Fgcc.git 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 --- 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