Hi! This is something we should have done when -std=c++23 was made the primary option and -std=c++2b turned into undocumented alias.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2025-01-15 Jakub Jelinek <ja...@redhat.com> gcc/cp/ * parser.cc (cp_parser_lambda_declarator_opt, cp_parser_statement, cp_parser_selection_statement, cp_parser_jump_statement): Use -std=c++23 and -std=gnu++23 in diagnostics rather than -std=c++2b and -std=gnu++2b. * semantics.cc (finish_compound_literal): Likewise. * typeck2.cc (build_functional_cast_1): Likewise. * decl.cc (start_decl): Likewise. * constexpr.cc (ensure_literal_type_for_constexpr_object, potential_constant_expression_1): Likewise. gcc/c-family/ * c-lex.cc (interpret_float): Use -std=c++23 and -std=gnu++23 in diagnostics rather than -std=c++2b and -std=gnu++2b. --- gcc/cp/parser.cc.jj 2025-01-15 08:43:39.070926235 +0100 +++ gcc/cp/parser.cc 2025-01-15 12:16:00.376964834 +0100 @@ -12165,8 +12165,8 @@ cp_parser_lambda_declarator_opt (cp_pars { pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda declaration " - "specifiers only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "specifiers only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); omitted_parms_loc = UNKNOWN_LOCATION; } /* Peek at the params, see if we have an xobj parameter. */ @@ -12262,8 +12262,8 @@ cp_parser_lambda_declarator_opt (cp_pars { pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda transaction " - "qualifier only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "qualifier only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); omitted_parms_loc = UNKNOWN_LOCATION; } @@ -12275,8 +12275,8 @@ cp_parser_lambda_declarator_opt (cp_pars { pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda exception " - "specification only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "specification only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); omitted_parms_loc = UNKNOWN_LOCATION; } @@ -12293,8 +12293,8 @@ cp_parser_lambda_declarator_opt (cp_pars if (omitted_parms_loc) pedwarn (omitted_parms_loc, OPT_Wc__23_extensions, "parameter declaration before lambda trailing " - "return type only optional with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "return type only optional with %<-std=c++23%> or " + "%<-std=gnu++23%>"); cp_lexer_consume_token (parser->lexer); return_type = cp_parser_trailing_type_id (parser); } @@ -13069,7 +13069,7 @@ cp_parser_statement (cp_parser* parser, if (cxx_dialect < cxx23) pedwarn (loc, OPT_Wc__23_extensions, "label at end of compound statement only available " - "with %<-std=c++2b%> or %<-std=gnu++2b%>"); + "with %<-std=c++23%> or %<-std=gnu++23%>"); return; } in_compound_for_pragma = false; @@ -13826,7 +13826,7 @@ cp_parser_selection_statement (cp_parser if (cxx_dialect < cxx23) pedwarn (tok->location, OPT_Wc__23_extensions, "%<if consteval%> only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); bool save_in_consteval_if_p = in_consteval_if_p; statement = begin_if_stmt (); @@ -15225,7 +15225,7 @@ cp_parser_jump_statement (cp_parser* par && cxx_dialect < cxx23) { error ("%<goto%> in %<constexpr%> function only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); cp_function_chain->invalid_constexpr = true; } --- gcc/cp/semantics.cc.jj 2025-01-10 10:32:28.723730783 +0100 +++ gcc/cp/semantics.cc 2025-01-15 12:16:14.453769788 +0100 @@ -3751,7 +3751,7 @@ finish_compound_literal (tree type, tree else if (cxx_dialect < cxx23) pedwarn (input_location, OPT_Wc__23_extensions, "%<auto{x}%> only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); type = do_auto_deduction (type, compound_literal, type, complain, adc_variable_type); if (type == error_mark_node) --- gcc/cp/typeck2.cc.jj 2025-01-15 08:43:39.071926221 +0100 +++ gcc/cp/typeck2.cc 2025-01-15 12:16:32.855514816 +0100 @@ -2507,7 +2507,7 @@ build_functional_cast_1 (location_t loc, else if (cxx_dialect < cxx23) pedwarn (loc, OPT_Wc__23_extensions, "%<auto(x)%> only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>"); + "%<-std=c++23%> or %<-std=gnu++23%>"); } else { --- gcc/cp/decl.cc.jj 2025-01-15 10:50:36.558273251 +0100 +++ gcc/cp/decl.cc 2025-01-15 12:15:34.124328583 +0100 @@ -6202,13 +6202,13 @@ start_decl (const cp_declarator *declara if (CP_DECL_THREAD_LOCAL_P (decl) && !DECL_REALLY_EXTERN (decl)) error_at (DECL_SOURCE_LOCATION (decl), "%qD defined %<thread_local%> in %qs function only " - "available with %<-std=c++2b%> or %<-std=gnu++2b%>", decl, + "available with %<-std=c++23%> or %<-std=gnu++23%>", decl, DECL_IMMEDIATE_FUNCTION_P (current_function_decl) ? "consteval" : "constexpr"); else if (TREE_STATIC (decl)) error_at (DECL_SOURCE_LOCATION (decl), "%qD defined %<static%> in %qs function only available " - "with %<-std=c++2b%> or %<-std=gnu++2b%>", decl, + "with %<-std=c++23%> or %<-std=gnu++23%>", decl, DECL_IMMEDIATE_FUNCTION_P (current_function_decl) ? "consteval" : "constexpr"); else --- gcc/cp/constexpr.cc.jj 2025-01-14 09:36:43.787521974 +0100 +++ gcc/cp/constexpr.cc 2025-01-15 12:15:18.736541793 +0100 @@ -122,7 +122,7 @@ ensure_literal_type_for_constexpr_object error_at (DECL_SOURCE_LOCATION (decl), "variable %qD of non-literal type %qT in " "%<constexpr%> function only available with " - "%<-std=c++2b%> or %<-std=gnu++2b%>", decl, type); + "%<-std=c++23%> or %<-std=gnu++23%>", decl, type); explain_non_literal_class (type); decl = error_mark_node; } @@ -10736,8 +10736,8 @@ potential_constant_expression_1 (tree t, return true; else if (flags & tf_error) constexpr_error (loc, fundef_p, "label definition in %<constexpr%> " - "function only available with %<-std=c++2b%> or " - "%<-std=gnu++2b%>"); + "function only available with %<-std=c++23%> or " + "%<-std=gnu++23%>"); return false; case ANNOTATE_EXPR: --- gcc/c-family/c-lex.cc.jj 2025-01-02 11:47:29.639230367 +0100 +++ gcc/c-family/c-lex.cc 2025-01-15 12:16:58.322161960 +0100 @@ -1307,7 +1307,7 @@ interpret_float (const cpp_token *token, if (cxx_dialect < cxx23 && pedantic) pedwarn (input_location, OPT_Wc__23_extensions, "%<f%d%> or %<F%d%> suffix on floating constant only " - "available with %<-std=c++2b%> or %<-std=gnu++2b%>", + "available with %<-std=c++23%> or %<-std=gnu++23%>", n, n); } else @@ -1328,7 +1328,7 @@ interpret_float (const cpp_token *token, else if (cxx_dialect < cxx23 && pedantic) pedwarn (input_location, OPT_Wc__23_extensions, "%<bf16%> or %<BF16%> suffix on floating constant only " - "available with %<-std=c++2b%> or %<-std=gnu++2b%>"); + "available with %<-std=c++23%> or %<-std=gnu++23%>"); } else if ((flags & CPP_N_WIDTH) == CPP_N_LARGE) type = long_double_type_node; Jakub