Hi!

The following patch adds a new -std= option arguments for C++29 and
changes __cplusplus value for C++26 from 202400L to 202603L.

Ok for trunk?

2026-06-12  Jakub Jelinek  <[email protected]>

gcc/
        * doc/invoke.texi (-std=c++2d, -std=c++29, -std=gnu++2d,
        -std=gnu++29): Document.
        * doc/cpp.texi: Adjust expected __cplusplus value for -std=c++26,
        document value for -std=c++29.
        * dwarf2out.cc (highest_c_language): Handle C++29.
        (gen_compile_unit_die): Likewise.  Adjust lversion for C++26.
gcc/c-family/
        * c-common.h (enum cxx_dialect): Add cxx29.
        * c-opts.cc (set_std_cxx29): New function.
        (c_common_handle_option): Handle -std=c++2d, -std=c++29, -std=gnu++2d
        and -std=gnu++29.
        * c.opt (std=c++2d, std=c++29, std=gnu++2d, std=gnu++29): New.
gcc/testsuite/
        * g++.dg/cpp26/cplusplus.C: Expect __cplusplus == 202603L.
        * g++.dg/cpp29/cplusplus.C: New test.
        * g++.dg/cpp29/feat-cxx29.C: New test.
        * lib/target-supports.exp (check_effective_target_c++26): Also
        true for C++29.
        (check_effective_target_c++26_down, check_effective_target_c++29_only,
        check_effective_target_c++29): New procedures.
        * lib/g++-dg.exp (g++-std-flags): Add 29 to the list too.
libcpp/
        * include/cpplib.h (enum c_lang): Add CLK_GNUCXX29 and CLK_CXX29.
        * init.cc (lang_defaults): Add CLK_GNUCXX29 and CLK_CXX29 row.
        (cpp_init_builtins): Change __cplusplus value for C++26 from 202400L
        to 202603L and set __cplusplus value for C++29 to 202700L.

--- gcc/c-family/c-common.h.jj  2026-06-05 10:39:31.134351137 +0200
+++ gcc/c-family/c-common.h     2026-06-12 17:00:25.426903046 +0200
@@ -751,7 +751,9 @@ enum cxx_dialect {
   /* C++23 */
   cxx23,
   /* C++26 */
-  cxx26
+  cxx26,
+  /* C++29 */
+  cxx29
 };
 
 /* The C++ dialect being used.  C++20 is the default.  */
--- gcc/c-family/c-opts.cc.jj   2026-05-30 17:45:09.345110280 +0200
+++ gcc/c-family/c-opts.cc      2026-06-12 17:25:31.330852780 +0200
@@ -118,6 +118,7 @@ static void set_std_cxx17 (int);
 static void set_std_cxx20 (int);
 static void set_std_cxx23 (int);
 static void set_std_cxx26 (int);
+static void set_std_cxx29 (int);
 static void set_std_c89 (int, int);
 static void set_std_c99 (int);
 static void set_std_c11 (int);
@@ -701,6 +702,12 @@ c_common_handle_option (size_t scode, co
        set_std_cxx26 (code == OPT_std_c__26 /* ISO */);
       break;
 
+    case OPT_std_c__29:
+    case OPT_std_gnu__29:
+      if (!preprocessing_asm_p)
+       set_std_cxx29 (code == OPT_std_c__29 /* ISO */);
+      break;
+
     case OPT_std_c90:
     case OPT_std_iso9899_199409:
       if (!preprocessing_asm_p)
@@ -2095,6 +2102,22 @@ set_std_cxx26 (int iso)
   lang_hooks.name = "GNU C++26";
 }
 
+/* Set the C++ 2029 standard (without GNU extensions if ISO).  */
+static void
+set_std_cxx29 (int iso)
+{
+  cpp_set_lang (parse_in, iso ? CLK_CXX29 : CLK_GNUCXX29);
+  flag_no_gnu_keywords = iso;
+  flag_no_nonansi_builtin = iso;
+  flag_iso = iso;
+  /* C++29 includes the C11 standard library.  */
+  flag_isoc94 = 1;
+  flag_isoc99 = 1;
+  flag_isoc11 = 1;
+  cxx_dialect = cxx29;
+  lang_hooks.name = "GNU C++29";
+}
+
 /* Args to -d specify what to dump.  Silently ignore
    unrecognized options; they may be aimed at toplev.cc.  */
 static void
--- gcc/c-family/c.opt.jj       2026-06-01 09:15:39.010605683 +0200
+++ gcc/c-family/c.opt  2026-06-12 17:05:03.744184261 +0200
@@ -2676,6 +2676,14 @@ std=c++26
 C++ ObjC++ Undocumented
 Conform to the ISO 2026 C++ draft standard (experimental and incomplete 
support).
 
+std=c++2d
+C++ ObjC++ Alias(std=c++29)
+Conform to the ISO 2029 C++ draft standard (experimental and incomplete 
support).
+
+std=c++29
+C++ ObjC++ Undocumented
+Conform to the ISO 2029 C++ draft standard (experimental and incomplete 
support).
+
 std=c11
 C ObjC
 Conform to the ISO 2011 C standard.
@@ -2778,6 +2786,14 @@ std=gnu++26
 C++ ObjC++ Undocumented
 Conform to the ISO 2026 C++ draft standard with GNU extensions (experimental 
and incomplete support).
 
+std=gnu++2d
+C++ ObjC++ Alias(std=gnu++29)
+Conform to the ISO 2029 C++ draft standard with GNU extensions (experimental 
and incomplete support).
+
+std=gnu++29
+C++ ObjC++ Undocumented
+Conform to the ISO 2029 C++ draft standard with GNU extensions (experimental 
and incomplete support).
+
 std=gnu11
 C ObjC
 Conform to the ISO 2011 C standard with GNU extensions.
--- gcc/doc/invoke.texi.jj      2026-06-10 17:42:21.458938285 +0200
+++ gcc/doc/invoke.texi 2026-06-12 17:27:00.453670490 +0200
@@ -2648,6 +2648,18 @@ change in incompatible ways in future re
 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
 and will almost certainly change in incompatible ways in future
 releases.
+
+@item c++2d
+@itemx c++29
+The upcoming revision of the ISO C++ standard, planned for
+2029.  Support is highly experimental, and will almost certainly
+change in incompatible ways in future releases.
+
+@item gnu++2d
+@itemx gnu++29
+GNU dialect of @option{-std=c++2d}.  Support is highly experimental,
+and will almost certainly change in incompatible ways in future
+releases.
 @end table
 
 @opindex aux-info
--- gcc/doc/cpp.texi.jj 2026-06-09 10:19:34.527847828 +0200
+++ gcc/doc/cpp.texi    2026-06-12 17:08:35.300367120 +0200
@@ -1912,9 +1912,10 @@ selected, the value of the macro is
 @code{201703L} for the 2017 C++ standard,
 @code{202002L} for the 2020 C++ standard,
 @code{202302L} for the 2023 C++ standard,
-or an unspecified value strictly larger than @code{202302L} for the
-experimental languages enabled by @option{-std=c++26} and
-@option{-std=gnu++26}.
+@code{202603L} for the 2026 C++ standard,
+or an unspecified value strictly larger than @code{202603L} for the
+experimental languages enabled by @option{-std=c++29} and
+@option{-std=gnu++29}.
 
 @item __OBJC__
 This macro is defined, with value 1, when the Objective-C compiler is in
--- gcc/testsuite/g++.dg/cpp26/cplusplus.C.jj   2026-03-27 10:17:15.650306001 
+0100
+++ gcc/testsuite/g++.dg/cpp26/cplusplus.C      2026-06-12 17:15:00.831233282 
+0200
@@ -1,3 +1,3 @@
 // { dg-do compile { target c++26_only } }
 
-static_assert(__cplusplus > 202302L);
+static_assert(__cplusplus == 202603L);
--- gcc/testsuite/g++.dg/cpp29/cplusplus.C.jj   2026-06-12 17:15:32.774807913 
+0200
+++ gcc/testsuite/g++.dg/cpp29/cplusplus.C      2026-06-12 17:16:32.290015391 
+0200
@@ -0,0 +1,3 @@
+// { dg-do compile { target c++29_only } }
+
+static_assert(__cplusplus > 202603L);
--- gcc/testsuite/g++.dg/cpp29/feat-cxx29.C.jj  2026-06-12 17:15:48.882593418 
+0200
+++ gcc/testsuite/g++.dg/cpp29/feat-cxx29.C     2026-06-12 17:16:03.543398189 
+0200
@@ -0,0 +1,660 @@
+// { dg-options "-std=c++29 -I${srcdir}/g++.dg/cpp1y 
-I${srcdir}/g++.dg/cpp1y/testinc" }
+// { dg-skip-if "requires hosted libstdc++ for complex" { ! hostedlib } }
+
+//  C++98 features:
+
+#ifndef __cpp_rtti
+#  error "__cpp_rtti"
+#elif  __cpp_rtti != 199711
+#  error "__cpp_rtti != 199711"
+#endif
+
+#ifndef __cpp_exceptions
+#  error "__cpp_exceptions"
+#elif  __cpp_exceptions != 199711
+#  error "__cpp_exceptions != 199711"
+#endif
+
+//  C++11 features:
+
+#ifndef __cpp_raw_strings
+#  error "__cpp_raw_strings"
+#elif __cpp_raw_strings != 200710
+#  error "__cpp_raw_strings != 200710"
+#endif
+
+#ifndef __cpp_unicode_literals
+#  error "__cpp_unicode_literals"
+#elif __cpp_unicode_literals != 200710
+#  error "__cpp_unicode_literals != 200710"
+#endif
+
+#ifndef __cpp_user_defined_literals
+#  error "__cpp_user_defined_literals"
+#elif __cpp_user_defined_literals != 200809
+#  error "__cpp_user_defined_literals != 200809"
+#endif
+
+#ifndef __cpp_lambdas
+#  error "__cpp_lambdas"
+#elif __cpp_lambdas != 200907
+#  error "__cpp_lambdas != 200907"
+#endif
+
+#ifndef __cpp_range_based_for
+#  error "__cpp_range_based_for"
+#elif __cpp_range_based_for != 202211
+#  error "__cpp_range_based_for != 202211"
+#endif
+
+#ifndef __cpp_decltype
+#  error "__cpp_decltype"
+#elif __cpp_decltype != 200707
+#  error "__cpp_decltype != 200707"
+#endif
+
+#ifndef __cpp_attributes
+#  error "__cpp_attributes"
+#elif __cpp_attributes != 200809
+#  error "__cpp_attributes != 200809"
+#endif
+
+#ifndef __cpp_rvalue_references
+#  error "__cpp_rvalue_references"
+#elif __cpp_rvalue_references != 200610
+#  error "__cpp_rvalue_references != 200610"
+#endif
+
+#ifndef __cpp_variadic_templates
+#  error "__cpp_variadic_templates"
+#elif __cpp_variadic_templates != 200704
+#  error "__cpp_variadic_templates != 200704"
+#endif
+
+#ifndef __cpp_initializer_lists
+#  error "__cpp_initializer_lists"
+#elif __cpp_initializer_lists != 200806
+#  error "__cpp_initializer_lists != 200806"
+#endif
+
+#ifndef __cpp_delegating_constructors
+#  error "__cpp_delegating_constructors"
+#elif __cpp_delegating_constructors != 200604
+#  error "__cpp_delegating_constructors != 200604"
+#endif
+
+#ifndef __cpp_nsdmi
+#  error "__cpp_nsdmi"
+#elif __cpp_nsdmi != 200809
+#  error "__cpp_nsdmi != 200809"
+#endif
+
+#ifndef __cpp_inheriting_constructors
+#  error "__cpp_inheriting_constructors"
+#elif  __cpp_inheriting_constructors!= 201511
+#  error "__cpp_inheriting_constructors != 201511"
+#endif
+
+#ifndef __cpp_ref_qualifiers
+#  error "__cpp_ref_qualifiers"
+#elif __cpp_ref_qualifiers != 200710
+#  error "__cpp_ref_qualifiers != 200710"
+#endif
+
+#ifndef __cpp_alias_templates
+#  error "__cpp_alias_templates"
+#elif __cpp_alias_templates != 200704
+#  error "__cpp_alias_templates != 200704"
+#endif
+
+#ifndef __cpp_threadsafe_static_init
+#  error "__cpp_threadsafe_static_init"
+#elif __cpp_threadsafe_static_init != 200806
+#  error "__cpp_threadsafe_static_init != 200806"
+#endif
+
+//  C++14 features:
+
+#ifndef __cpp_binary_literals
+#  error "__cpp_binary_literals"
+#elif __cpp_binary_literals != 201304
+#  error "__cpp_binary_literals != 201304"
+#endif
+
+#ifndef __cpp_init_captures
+#  error "__cpp_init_captures"
+#elif __cpp_init_captures != 201803
+#  error "__cpp_init_captures != 201803"
+#endif
+
+#ifndef __cpp_generic_lambdas
+#  error "__cpp_generic_lambdas"
+#elif __cpp_generic_lambdas != 201707
+#  error "__cpp_generic_lambdas != 201707"
+#endif
+
+#ifndef __cpp_constexpr
+#  error "__cpp_constexpr"
+#elif __cpp_constexpr != 202406L
+#  error "__cpp_constexpr != 202406L"
+#endif
+
+#ifndef __cpp_decltype_auto
+#  error "__cpp_decltype_auto"
+#elif __cpp_decltype_auto != 201304
+#  error "__cpp_decltype_auto != 201304"
+#endif
+
+#ifndef __cpp_return_type_deduction
+#  error "__cpp_return_type_deduction"
+#elif __cpp_return_type_deduction != 201304
+#  error "__cpp_return_type_deduction != 201304"
+#endif
+
+#ifndef __cpp_aggregate_nsdmi
+#  error "__cpp_aggregate_nsdmi"
+#elif __cpp_aggregate_nsdmi != 201304
+#  error "__cpp_aggregate_nsdmi != 201304"
+#endif
+
+#ifndef __cpp_variable_templates
+#  error "__cpp_variable_templates"
+#elif __cpp_variable_templates != 201304
+#  error "__cpp_variable_templates != 201304"
+#endif
+
+#ifndef __cpp_digit_separators
+#  error "__cpp_digit_separators"
+#elif __cpp_digit_separators != 201309
+#  error "__cpp_digit_separators != 201309"
+#endif
+
+#ifndef __cpp_sized_deallocation
+#  error "__cpp_sized_deallocation"
+#elif __cpp_sized_deallocation != 201309
+#  error "__cpp_sized_deallocation != 201309"
+#endif
+
+//  GNU VLA support:
+
+#ifndef __cpp_runtime_arrays
+#  error "__cpp_runtime_arrays"
+#elif __cpp_runtime_arrays != 198712
+#  error "__cpp_runtime_arrays != 198712"
+#endif
+
+//  C++11 attributes:
+
+#ifdef __has_cpp_attribute
+#  if ! __has_cpp_attribute(noreturn)
+#    error "__has_cpp_attribute(noreturn)"
+#  elif __has_cpp_attribute(noreturn) != 200809
+#    error "__has_cpp_attribute(noreturn) != 200809"
+#  endif
+#else
+#  error "__has_cpp_attribute"
+#endif
+
+//  Attribute carries_dependency not in yet.
+//#ifdef __has_cpp_attribute
+//#  if ! __has_cpp_attribute(carries_dependency)
+//#    error "__has_cpp_attribute(carries_dependency)"
+//#  elif __has_cpp_attribute(carries_dependency) != 200809
+//#    error "__has_cpp_attribute(carries_dependency) != 200809"
+//#  endif
+//#else
+//#  error "__has_cpp_attribute"
+//#endif
+
+//  C++14 attributes:
+
+#ifdef __has_cpp_attribute
+#  if ! __has_cpp_attribute(deprecated)
+#    error "__has_cpp_attribute(deprecated)"
+#  elif __has_cpp_attribute(deprecated) != 201309
+#    error "__has_cpp_attribute(deprecated) != 201309"
+#  endif
+#else
+#  error "__has_cpp_attribute"
+#endif
+
+//  Include checks:
+
+//  Check for __has_include macro.
+#ifndef __has_include
+#  error "__has_include"
+#endif
+
+//  Try known bracket header (use operator).
+#if __has_include (<complex>)
+#else
+#  error "<complex>"
+#endif
+
+//  Define and use a macro to invoke the operator.
+#define sluggo(TXT) __has_include(TXT)
+
+#if sluggo(<complex>)
+#else
+#  error "<complex>"
+#endif
+
+#if ! sluggo(<complex>)
+#  error "<complex>"
+#else
+#endif
+
+//  Quoted complex.h should find at least the bracket version.
+#if __has_include("complex.h")
+#else
+#  error "complex.h"
+#endif
+
+//  Try known local quote header.
+#if __has_include("complex_literals.h")
+#else
+#  error "\"complex_literals.h\""
+#endif
+
+//  Try nonexistent bracket header.
+#if __has_include(<stuff>)
+#  error "<stuff>"
+#else
+#endif
+
+//  Try nonexistent quote header.
+#if __has_include("phlegm")
+#  error "\"phlegm\""
+#else
+#endif
+
+//  Test __has_include_next.
+#if __has_include("phoobhar.h")
+#  include "phoobhar.h"
+#else
+#  error "__has_include(\"phoobhar.h\")"
+#endif
+
+//  Try a macro.
+#define COMPLEX_INC "complex.h"
+#if __has_include(COMPLEX_INC)
+#else
+#  error COMPLEX_INC
+#endif
+
+//  Realistic use of __has_include.
+#if __has_include(<array>)
+#  define STD_ARRAY 1
+#  include <array>
+  template<typename _Tp, std::size_t _Num>
+    using array = std::array<_Tp, _Num>;
+#elif __has_include(<tr1/array>)
+#  define TR1_ARRAY 1
+#  include <tr1/array>
+  template<typename _Tp, std::size_t _Num>
+    typedef std::tr1::array<_Tp, _Num> array;
+#endif
+
+// C++17 features:
+
+#ifndef __cpp_unicode_characters
+#  error "__cpp_unicode_characters"
+#elif __cpp_unicode_characters != 201411
+#  error "__cpp_unicode_characters != 201411"
+#endif
+
+#ifndef __cpp_static_assert
+#  error "__cpp_static_assert"
+#elif __cpp_static_assert != 202306
+#  error "__cpp_static_assert != 202306"
+#endif
+
+#ifndef __cpp_namespace_attributes
+#  error "__cpp_namespace_attributes"
+#elif __cpp_namespace_attributes != 201411
+#  error "__cpp_namespace_attributes != 201411"
+#endif
+
+#ifndef __cpp_enumerator_attributes
+#  error "__cpp_enumerator_attributes"
+#elif __cpp_enumerator_attributes != 201411
+#  error "__cpp_enumerator_attributes != 201411"
+#endif
+
+#ifndef __cpp_nested_namespace_definitions
+#  error "__cpp_nested_namespace_definitions"
+#elif __cpp_nested_namespace_definitions != 201411
+#  error "__cpp_nested_namespace_definitions != 201411"
+#endif
+
+#ifndef __cpp_fold_expressions
+#  error "__cpp_fold_expressions"
+#elif __cpp_fold_expressions != 201603
+#  error "__cpp_fold_expressions != 201603"
+#endif
+
+#ifndef __cpp_nontype_template_args
+#  error "__cpp_nontype_template_args"
+#elif __cpp_nontype_template_args != 201911
+#  error "__cpp_nontype_template_args != 201911"
+#endif
+
+#ifndef __cpp_hex_float
+#  error "__cpp_hex_float"
+#elif __cpp_hex_float != 201603
+#  error "__cpp_hex_float != 201603"
+#endif
+
+#ifndef __cpp_aggregate_bases
+#  error "__cpp_aggregate_bases"
+#elif __cpp_aggregate_bases != 201603
+#  error "__cpp_aggregate_bases != 201603"
+#endif
+
+#ifndef __cpp_deduction_guides
+#  error "__cpp_deduction_guides"
+#elif __cpp_deduction_guides != 202207
+#  error "__cpp_deduction_guides != 202207"
+#endif
+
+#ifndef __cpp_if_constexpr
+#  error "__cpp_if_constexpr"
+#elif __cpp_if_constexpr != 201606
+#  error "__cpp_if_constexpr != 201606"
+#endif
+
+#ifndef __cpp_aligned_new
+#  error "__cpp_aligned_new"
+#elif __cpp_aligned_new != 201606
+#  error "__cpp_aligned_new != 201606"
+#endif
+
+#ifndef __cpp_template_auto
+#  error "__cpp_template_auto"
+#elif __cpp_template_auto != 201606
+#  error "__cpp_template_auto != 201606"
+#endif
+
+#ifndef __cpp_inline_variables
+#  error "__cpp_inline_variables"
+#elif __cpp_inline_variables != 201606
+#  error "__cpp_inline_variables != 201606"
+#endif
+
+#ifndef __cpp_capture_star_this
+#  error "__cpp_capture_star_this"
+#elif __cpp_capture_star_this != 201603
+#  error "__cpp_capture_star_this != 201603"
+#endif
+
+#ifndef __cpp_noexcept_function_type
+#  error "__cpp_noexcept_function_type"
+#elif __cpp_noexcept_function_type != 201510
+#  error "__cpp_noexcept_function_type != 201510"
+#endif
+
+#ifndef __cpp_structured_bindings
+#  error "__cpp_structured_bindings"
+#elif __cpp_structured_bindings != 202411
+#  error "__cpp_structured_bindings != 202411"
+#endif
+
+#ifndef __cpp_template_template_args
+#  error "__cpp_template_template_args"
+#elif __cpp_template_template_args != 201611
+#  error "__cpp_template_template_args != 201611"
+#endif
+
+#ifndef __cpp_variadic_using
+#  error "__cpp_variadic_using"
+#elif __cpp_variadic_using != 201611
+#  error "__cpp_variadic_using != 201611"
+#endif
+
+#ifndef __cpp_guaranteed_copy_elision
+#  error "__cpp_guaranteed_copy_elision"
+#elif __cpp_guaranteed_copy_elision != 201606
+#  error "__cpp_guaranteed_copy_elision != 201606"
+#endif
+
+#ifndef __cpp_nontype_template_parameter_auto
+#  error "__cpp_nontype_template_parameter_auto"
+#elif __cpp_nontype_template_parameter_auto != 201606
+#  error "__cpp_nontype_template_parameter_auto != 201606"
+#endif
+
+// C++20 features:
+
+#ifndef __cpp_conditional_explicit
+#  error "__cpp_conditional_explicit"
+#elif __cpp_conditional_explicit != 201806
+#  error "__cpp_conditional_explicit != 201806"
+#endif
+
+#ifndef __cpp_nontype_template_parameter_class
+#  error "__cpp_nontype_template_parameter_class"
+#elif __cpp_nontype_template_parameter_class != 201806
+#  error "__cpp_nontype_template_parameter_class != 201806"
+#endif
+
+#ifndef __cpp_impl_destroying_delete
+#  error "__cpp_impl_destroying_delete"
+#elif __cpp_impl_destroying_delete != 201806
+#  error "__cpp_impl_destroying_delete != 201806"
+#endif
+
+#ifndef __cpp_constinit
+#  error "__cpp_constinit"
+#elif __cpp_constinit != 201907
+#  error "__cpp_constinit != 201907"
+#endif
+
+#ifndef __cpp_constexpr_dynamic_alloc
+#  error "__cpp_constexpr_dynamic_alloc"
+#elif __cpp_constexpr_dynamic_alloc != 201907
+#  error "__cpp_constexpr_dynamic_alloc != 201907"
+#endif
+
+#ifndef __cpp_aggregate_paren_init
+#  error "__cpp_aggregate_paren_init"
+#elif __cpp_aggregate_paren_init != 201902
+#  error "__cpp_aggregate_paren_init != 201902"
+#endif
+
+#ifndef __cpp_char8_t
+#  error "__cpp_char8_t"
+#elif __cpp_char8_t != 202207
+#  error "__cpp_char8_t != 202207"
+#endif
+
+#ifndef __cpp_designated_initializers
+#  error "__cpp_designated_initializers"
+#elif __cpp_designated_initializers != 201707
+#  error "__cpp_designated_initializers != 201707"
+#endif
+
+#ifndef __cpp_constexpr_in_decltype
+#  error "__cpp_constexpr_in_decltype"
+#elif __cpp_constexpr_in_decltype != 201711
+#  error "__cpp_constexpr_in_decltype != 201711"
+#endif
+
+#ifndef __cpp_consteval
+#  error "__cpp_consteval"
+#elif __cpp_consteval != 202211L
+#  error "__cpp_consteval != 202211L"
+#endif
+
+#ifndef __cpp_concepts
+#  error "__cpp_concepts"
+#elif __cpp_concepts != 202002
+#  error "__cpp_concepts != 202002"
+#endif
+
+#ifndef __cpp_using_enum
+#  error "__cpp_using_enum"
+#elif __cpp_using_enum != 201907
+#  error "__cpp_using_enum != 201907"
+#endif
+
+// C++20 attributes:
+
+#ifdef __has_cpp_attribute
+
+#  if ! __has_cpp_attribute(maybe_unused)
+#    error "__has_cpp_attribute(maybe_unused)"
+#  elif __has_cpp_attribute(maybe_unused) != 201603
+#    error "__has_cpp_attribute(maybe_unused) != 201603"
+#  endif
+
+#  if ! __has_cpp_attribute(nodiscard)
+#    error "__has_cpp_attribute(nodiscard)"
+#  elif __has_cpp_attribute(nodiscard) != 201907
+#    error "__has_cpp_attribute(nodiscard) != 201907"
+#  endif
+
+#  if ! __has_cpp_attribute(fallthrough)
+#    error "__has_cpp_attribute(fallthrough)"
+#  elif __has_cpp_attribute(fallthrough) != 201603
+#    error "__has_cpp_attribute(fallthrough) != 201603"
+#  endif
+
+#  if ! __has_cpp_attribute(no_unique_address)
+#    error "__has_cpp_attribute(no_unique_address)"
+#  elif __has_cpp_attribute(no_unique_address) != 201803
+#    error "__has_cpp_attribute(no_unique_address) != 201803"
+#  endif
+
+#  if ! __has_cpp_attribute(likely)
+#    error "__has_cpp_attribute(likely)"
+#  elif __has_cpp_attribute(likely) != 201803
+#    error "__has_cpp_attribute(likely) != 201803"
+#  endif
+
+#  if ! __has_cpp_attribute(unlikely)
+#    error "__has_cpp_attribute(unlikely)"
+#  elif __has_cpp_attribute(unlikely) != 201803
+#    error "__has_cpp_attribute(unlikely) != 201803"
+#  endif
+
+#else
+#  error "__has_cpp_attribute"
+#endif
+
+// C++23 features:
+
+#ifndef __cpp_size_t_suffix
+#  error "__cpp_size_t_suffix"
+#elif __cpp_size_t_suffix != 202011
+#  error "__cpp_size_t_suffix != 202011"
+#endif
+
+#ifndef __cpp_if_consteval
+#  error "__cpp_if_consteval"
+#elif __cpp_if_consteval != 202106
+#  error "__cpp_if_consteval != 202106"
+#endif
+
+#ifndef __cpp_multidimensional_subscript
+#  error "__cpp_multidimensional_subscript"
+#elif __cpp_multidimensional_subscript != 202211
+#  error "__cpp_multidimensional_subscript != 202211"
+#endif
+
+#ifndef __cpp_named_character_escapes
+#  error "__cpp_named_character_escapes"
+#elif __cpp_named_character_escapes != 202207
+#  error "__cpp_named_character_escapes != 202207"
+#endif
+
+#ifndef __cpp_static_call_operator
+#  error "__cpp_static_call_operator"
+#elif __cpp_static_call_operator != 202207
+#  error "__cpp_static_call_operator != 202207"
+#endif
+
+#ifndef __cpp_implicit_move
+#  error "__cpp_implicit_move"
+#elif __cpp_implicit_move != 202207
+#  error "__cpp_implicit_move != 202207"
+#endif
+
+#ifndef __cpp_explicit_this_parameter
+#  error "__cpp_explicit_this_parameter"
+#elif __cpp_explicit_this_parameter != 202110
+#  error "__cpp_explicit_this_parameter != 202110"
+#endif
+
+#ifndef __cpp_auto_cast
+#  error "__cpp_auto_cast"
+#elif __cpp_auto_cast != 202110
+#  error "__cpp_auto_cast != 202110"
+#endif
+
+// C++23 attributes:
+
+#ifdef __has_cpp_attribute
+#  if ! __has_cpp_attribute(assume)
+#    error "__has_cpp_attribute(assume)"
+#  elif __has_cpp_attribute(assume) != 202207
+#    error "__has_cpp_attribute(assume) != 202207"
+#  endif
+#else
+#  error "__has_cpp_attribute"
+#endif
+
+// C++26 features:
+
+#ifndef __cpp_placeholder_variables
+#  error "__cpp_placeholder_variables"
+#elif __cpp_placeholder_variables != 202306
+#  error "__cpp_placeholder_variables != 202306"
+#endif
+
+#ifndef __cpp_deleted_function
+#  error "__cpp_deleted_function"
+#elif __cpp_deleted_function != 202403
+#  error "__cpp_deleted_function != 202403"
+#endif
+
+#ifndef __cpp_variadic_friend
+#  error "__cpp_variadic_friend"
+#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
+
+#ifndef __cpp_pp_embed
+#  error "__cpp_pp_embed"
+#elif __cpp_pp_embed != 202502
+#  error "__cpp_pp_embed != 202502"
+#endif
+
+#ifndef __cpp_constexpr_virtual_inheritance
+#  error "__cpp_constexpr_virtual_inheritance"
+#elif __cpp_constexpr_virtual_inheritance != 202506
+#  error "__cpp_constexpr_virtual_inheritance != 202506"
+#endif
+
+#ifndef __cpp_constexpr_exceptions
+#  error "__cpp_constexpr_exceptions"
+#elif __cpp_constexpr_exceptions != 202411
+#  error "__cpp_constexpr_exceptions != 202411"
+#endif
+
+#ifndef __cpp_expansion_statements
+#  error "__cpp_expansion_statements"
+#elif __cpp_expansion_statements != 202506
+#  error "__cpp_expansion_statements != 202506"
+#endif
+
+#ifndef __cpp_trivial_union
+#  error "__cpp_trivial_union"
+#elif __cpp_trivial_union != 202502
+#  error "__cpp_trivial_union != 202502"
+#endif
--- gcc/testsuite/lib/target-supports.exp.jj    2026-06-12 16:55:06.698171156 
+0200
+++ gcc/testsuite/lib/target-supports.exp       2026-06-12 17:20:44.359659689 
+0200
@@ -12540,7 +12540,35 @@ proc check_effective_target_c++26_only {
 }
 
 proc check_effective_target_c++26 { } {
-    return [check_effective_target_c++26_only]
+    if [check_effective_target_c++26_only] {
+       return 1
+    }
+    return [check_effective_target_c++29]
+}
+
+proc check_effective_target_c++26_down { } {
+    if ![check_effective_target_c++] {
+       return 0
+    }
+    return [expr ![check_effective_target_c++29] ]
+}
+
+proc check_effective_target_c++29_only { } {
+    global cxx_default
+    if ![check_effective_target_c++] {
+       return 0
+    }
+    if [check-flags { { } { } { -std=c++29 -std=gnu++29 -std=c++2d 
-std=gnu++2d } }] {
+       return 1
+    }
+    if { $cxx_default == "c++29" && [check-flags { { } { } { } { -std=* } }] } 
{
+       return 1
+    }
+    return 0
+}
+
+proc check_effective_target_c++29 { } {
+    return [check_effective_target_c++29_only]
 }
 
 # Check for C++ Concepts support, i.e. -fconcepts flag.
--- gcc/testsuite/lib/g++-dg.exp.jj     2026-03-27 10:17:21.308213672 +0100
+++ gcc/testsuite/lib/g++-dg.exp        2026-06-12 17:21:41.122906679 +0200
@@ -78,7 +78,7 @@ proc g++-std-flags { test } {
            # The order of this list is significant: first $cxx_default,
            # then the oldest and newest, then others in rough order of
            # importance based on test coverage and usage.
-           foreach ver { 20 98 26 17 11 14 23 } {
+           foreach ver { 20 98 26 17 11 14 23 29 } {
                set cmpver $ver
                if { $ver == 98 } { set cmpver 03 }
                if { [llength $std_list] < 3
--- gcc/dwarf2out.cc.jj 2026-05-30 17:45:09.404109533 +0200
+++ gcc/dwarf2out.cc    2026-06-12 17:13:54.895111309 +0200
@@ -25640,6 +25640,8 @@ static char *producer_string;
 static const char *
 highest_c_language (const char *lang1, const char *lang2)
 {
+  if (strcmp ("GNU C++29", lang1) == 0 || strcmp ("GNU C++29", lang2) == 0)
+    return "GNU C++29";
   if (strcmp ("GNU C++26", lang1) == 0 || strcmp ("GNU C++26", lang2) == 0)
     return "GNU C++26";
   if (strcmp ("GNU C++23", lang1) == 0 || strcmp ("GNU C++23", lang2) == 0)
@@ -25794,7 +25796,13 @@ gen_compile_unit_die (const char *filena
            {
              language = DW_LANG_C_plus_plus_14;
              lname = DW_LNAME_C_plus_plus;
-             lversion = 202400;
+             lversion = 202603;
+           }
+         else if (strcmp (language_string, "GNU C++29") == 0)
+           {
+             language = DW_LANG_C_plus_plus_14;
+             lname = DW_LNAME_C_plus_plus;
+             lversion = 202700;
            }
        }
     }
--- libcpp/include/cpplib.h.jj  2026-05-30 17:45:09.502108293 +0200
+++ libcpp/include/cpplib.h     2026-06-12 17:22:11.101508989 +0200
@@ -183,7 +183,8 @@ enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99,
             CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,
             CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17,
             CLK_GNUCXX20, CLK_CXX20, CLK_GNUCXX23, CLK_CXX23,
-            CLK_GNUCXX26, CLK_CXX26, CLK_ASM};
+            CLK_GNUCXX26, CLK_CXX26, CLK_GNUCXX29, CLK_CXX29,
+            CLK_ASM};
 
 /* Payload of a NUMBER, STRING, CHAR or COMMENT token.  */
 struct GTY(()) cpp_string {
--- libcpp/init.cc.jj   2026-03-27 10:17:21.566209462 +0100
+++ libcpp/init.cc      2026-06-12 17:23:29.230472545 +0200
@@ -151,6 +151,8 @@ static const struct lang_flags lang_defa
   /* CXX23    */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,0,1 },
   /* GNUCXX26 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,0,1 },
   /* CXX26    */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,0,1 },
+  /* GNUCXX29 */ { 1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,0,1 },
+  /* CXX29    */ { 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,0,1 },
   /* ASM      */ { 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
 };
 
@@ -599,11 +601,14 @@ cpp_init_builtins (cpp_reader *pfile, in
 
   if (CPP_OPTION (pfile, cplusplus))
     {
-      /* C++26 is not yet a standard.  For now, use an invalid
-        year/month, 202400L, which is larger than 202302L.  */
-      if (CPP_OPTION (pfile, lang) == CLK_CXX26
-         || CPP_OPTION (pfile, lang) == CLK_GNUCXX26)
-       _cpp_define_builtin (pfile, "__cplusplus 202400L");
+      /* C++29 is not yet a standard.  For now, use an invalid
+        year/month, 202700L, which is larger than 202603L.  */
+      if (CPP_OPTION (pfile, lang) == CLK_CXX29
+         || CPP_OPTION (pfile, lang) == CLK_GNUCXX29)
+       _cpp_define_builtin (pfile, "__cplusplus 202700L");
+      else if (CPP_OPTION (pfile, lang) == CLK_CXX26
+              || CPP_OPTION (pfile, lang) == CLK_GNUCXX26)
+       _cpp_define_builtin (pfile, "__cplusplus 202603L");
       else if (CPP_OPTION (pfile, lang) == CLK_CXX23
          || CPP_OPTION (pfile, lang) == CLK_GNUCXX23)
        _cpp_define_builtin (pfile, "__cplusplus 202302L");

        Jakub

Reply via email to