diff options
author | Jason Merrill <jason@redhat.com> | 2020-05-13 15:15:13 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-05-13 15:16:49 -0400 |
commit | b04445d4a809eaf0460fd4f1f35b1a7d458c8c72 (patch) | |
tree | 1d745c4af52475c2d51a48a637c14c520fa9664d /gcc/cp | |
parent | c3cb34c632222093718fc55f45dde68e97abf9dc (diff) | |
download | gcc-b04445d4a809eaf0460fd4f1f35b1a7d458c8c72.zip gcc-b04445d4a809eaf0460fd4f1f35b1a7d458c8c72.tar.gz gcc-b04445d4a809eaf0460fd4f1f35b1a7d458c8c72.tar.bz2 |
c++: Replace "C++2a" with "C++20".
C++20 isn't final quite yet, but all that remains is formalities, so let's
go ahead and change all the references.
I think for the next C++ standard we can just call it C++23 rather than
C++2b, since the committee has been consistent about time-based releases
rather than feature-based.
gcc/c-family/ChangeLog
2020-05-13 Jason Merrill <jason@redhat.com>
* c.opt (std=c++20): Make c++2a the alias.
(std=gnu++20): Likewise.
* c-common.h (cxx_dialect): Change cxx2a to cxx20.
* c-opts.c: Adjust.
* c-cppbuiltin.c: Adjust.
* c-ubsan.c: Adjust.
* c-warn.c: Adjust.
gcc/cp/ChangeLog
2020-05-13 Jason Merrill <jason@redhat.com>
* call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
typeck2.c: Change cxx2a to cxx20.
libcpp/ChangeLog
2020-05-13 Jason Merrill <jason@redhat.com>
* include/cpplib.h (enum c_lang): Change CXX2A to CXX20.
* init.c, lex.c: Adjust.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 10 | ||||
-rw-r--r-- | gcc/cp/class.c | 10 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 38 | ||||
-rw-r--r-- | gcc/cp/constraint.cc | 2 | ||||
-rw-r--r-- | gcc/cp/decl.c | 34 | ||||
-rw-r--r-- | gcc/cp/init.c | 6 | ||||
-rw-r--r-- | gcc/cp/lambda.c | 2 | ||||
-rw-r--r-- | gcc/cp/lex.c | 2 | ||||
-rw-r--r-- | gcc/cp/method.c | 18 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 40 | ||||
-rw-r--r-- | gcc/cp/parser.c | 102 | ||||
-rw-r--r-- | gcc/cp/pt.c | 20 | ||||
-rw-r--r-- | gcc/cp/tree.c | 4 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 8 |
15 files changed, 154 insertions, 148 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7515827..11b3fdc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-05-13 Jason Merrill <jason@redhat.com> + + * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c, + lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c, + typeck2.c: Change cxx2a to cxx20. + 2020-05-12 Marek Polacek <polacek@redhat.com> PR c++/95074 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 85d670f..940e65d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6041,7 +6041,7 @@ add_operator_candidates (z_candidate **candidates, /* Maybe add C++20 rewritten comparison candidates. */ tree_code rewrite_code = ERROR_MARK; - if (cxx_dialect >= cxx2a + if (cxx_dialect >= cxx20 && nargs == 2 && (OVERLOAD_TYPE_P (arg1_type) || OVERLOAD_TYPE_P (arg2_type))) switch (code) @@ -6599,7 +6599,7 @@ extract_call_expr (tree call) call = TREE_OPERAND (call, 0); if (TREE_CODE (call) == TARGET_EXPR) call = TARGET_EXPR_INITIAL (call); - if (cxx_dialect >= cxx2a) + if (cxx_dialect >= cxx20) switch (TREE_CODE (call)) { /* C++20 rewritten comparison operators. */ @@ -7280,7 +7280,7 @@ maybe_inform_about_fndecl_for_bogus_argument_init (tree fn, int argnum) static void maybe_warn_array_conv (location_t loc, conversion *c, tree expr) { - if (cxx_dialect >= cxx2a) + if (cxx_dialect >= cxx20) return; tree type = TREE_TYPE (expr); @@ -7292,7 +7292,7 @@ maybe_warn_array_conv (location_t loc, conversion *c, tree expr) if (conv_binds_to_array_of_unknown_bound (c)) pedwarn (loc, OPT_Wpedantic, "conversions to arrays of unknown bound " - "are only available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "are only available with %<-std=c++20%> or %<-std=gnu++20%>"); } /* Perform the conversions in CONVS on the expression EXPR. FN and @@ -10251,7 +10251,7 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args, the two. */ if (DECL_CONSTRUCTOR_P (fn) && !(flags & LOOKUP_ONLYCONVERTING) - && cxx_dialect >= cxx2a + && cxx_dialect >= cxx20 && CP_AGGREGATE_TYPE_P (basetype) && !user_args->is_empty ()) { diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b66b8d4..15f490d 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5314,7 +5314,7 @@ trivial_default_constructor_is_constexpr (tree t) struct S { int i; constexpr S() = default; }; should work. */ - return (cxx_dialect >= cxx2a + return (cxx_dialect >= cxx20 || is_really_empty_class (t, /*ignore_vptr*/true)); } @@ -5691,7 +5691,7 @@ finalize_literal_type_property (tree t) CLASSTYPE_LITERAL_P (t) = false; else if (CLASSTYPE_LITERAL_P (t) && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) - && (cxx_dialect < cxx2a || !type_maybe_constexpr_destructor (t))) + && (cxx_dialect < cxx20 || !type_maybe_constexpr_destructor (t))) CLASSTYPE_LITERAL_P (t) = false; else if (CLASSTYPE_LITERAL_P (t) && LAMBDA_TYPE_P (t)) CLASSTYPE_LITERAL_P (t) = (cxx_dialect >= cxx17); @@ -5745,7 +5745,7 @@ explain_non_literal_class (tree t) inform (UNKNOWN_LOCATION, " %qT is a closure type, which is only literal in " "C++17 and later", t); - else if (cxx_dialect < cxx2a && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) + else if (cxx_dialect < cxx20 && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)) inform (UNKNOWN_LOCATION, " %q+T has a non-trivial destructor", t); else if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) && !type_maybe_constexpr_destructor (t)) @@ -5893,7 +5893,7 @@ check_bases_and_members (tree t) Again, other conditions for being an aggregate are checked elsewhere. */ CLASSTYPE_NON_AGGREGATE (t) - |= ((cxx_dialect < cxx2a + |= ((cxx_dialect < cxx20 ? type_has_user_provided_or_explicit_constructor (t) : TYPE_HAS_USER_CONSTRUCTOR (t)) || TYPE_POLYMORPHIC_P (t)); @@ -7499,7 +7499,7 @@ finish_struct (tree t, tree attributes) /* Remember current #pragma pack value. */ TYPE_PRECISION (t) = maximum_field_alignment; - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) { if (!CLASSTYPE_NON_AGGREGATE (t) && type_has_user_provided_or_explicit_constructor (t)) diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 706d8a1..04faabc 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -768,7 +768,7 @@ static bool cx_check_missing_mem_inits (tree ctype, tree body, bool complain) { /* We allow uninitialized bases/fields in C++20. */ - if (cxx_dialect >= cxx2a) + if (cxx_dialect >= cxx20) return false; unsigned nelts = 0; @@ -1723,7 +1723,7 @@ modifying_const_object_error (tree expr, tree obj) static inline bool cxx_replaceable_global_alloc_fn (tree fndecl) { - return (cxx_dialect >= cxx2a + return (cxx_dialect >= cxx20 && IDENTIFIER_NEWDEL_OP_P (DECL_NAME (fndecl)) && CP_DECL_CONTEXT (fndecl) == global_namespace && (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl) @@ -1736,7 +1736,7 @@ cxx_replaceable_global_alloc_fn (tree fndecl) static inline bool cxx_placement_new_fn (tree fndecl) { - if (cxx_dialect >= cxx2a + if (cxx_dialect >= cxx20 && IDENTIFIER_NEW_OP_P (DECL_NAME (fndecl)) && CP_DECL_CONTEXT (fndecl) == global_namespace && !DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl) @@ -1789,7 +1789,7 @@ is_std_allocator_allocate (tree fndecl) static inline bool cxx_dynamic_cast_fn_p (tree fndecl) { - return (cxx_dialect >= cxx2a + return (cxx_dialect >= cxx20 && id_equal (DECL_NAME (fndecl), "__dynamic_cast") && CP_DECL_CONTEXT (fndecl) == global_namespace); } @@ -2628,7 +2628,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, of value-initializing it. (reduced_constant_expression_p is expected to take care of clearing the flag.) */ if (TREE_CODE (result) == CONSTRUCTOR - && (cxx_dialect < cxx2a + && (cxx_dialect < cxx20 || !DECL_CONSTRUCTOR_P (fun))) clear_no_implicit_zero (result); @@ -2661,11 +2661,11 @@ reduced_constant_expression_p (tree t) if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) /* An initialized vector would have a VECTOR_CST. */ return false; - else if (cxx_dialect >= cxx2a + else if (cxx_dialect >= cxx20 /* An ARRAY_TYPE doesn't have any TYPE_FIELDS. */ && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) field = NULL_TREE; - else if (cxx_dialect >= cxx2a + else if (cxx_dialect >= cxx20 && TREE_CODE (TREE_TYPE (t)) == UNION_TYPE) { if (CONSTRUCTOR_NELTS (t) == 0) @@ -2784,13 +2784,13 @@ cxx_eval_check_shift_p (location_t loc, const constexpr_ctx *ctx, representable in the corresponding unsigned type of the result type, then that value, converted to the result type, is the resulting value; otherwise, the behavior is undefined. - For C++2a: + For C++20: The value of E1 << E2 is the unique value congruent to E1 x 2^E2 modulo 2^N, where N is the range exponent of the type of the result. */ if (code == LSHIFT_EXPR && !TYPE_UNSIGNED (lhstype) && cxx_dialect >= cxx11 - && cxx_dialect < cxx2a) + && cxx_dialect < cxx20) { if (tree_int_cst_sgn (lhs) == -1) { @@ -4803,7 +4803,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, if (code == UNION_TYPE && CONSTRUCTOR_NELTS (*valp) && CONSTRUCTOR_ELT (*valp, 0)->index != index) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) { if (!ctx->quiet) error_at (cp_expr_loc_or_input_loc (t), @@ -5422,7 +5422,7 @@ inline_asm_in_constexpr_error (location_t loc) auto_diagnostic_group d; error_at (loc, "inline assembly is not a constant expression"); inform (loc, "only unevaluated inline assembly is allowed in a " - "%<constexpr%> function in C++2a"); + "%<constexpr%> function in C++20"); } /* Attempt to reduce the expression T to a constant value. @@ -6582,7 +6582,7 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant, type = TREE_TYPE (object); else { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) return t; if (TREE_CODE (t) != CALL_EXPR && TREE_CODE (t) != AGGR_INIT_EXPR) return t; @@ -6595,7 +6595,7 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant, is_consteval = true; } } - else if (cxx_dialect >= cxx2a + else if (cxx_dialect >= cxx20 && (TREE_CODE (t) == CALL_EXPR || TREE_CODE (t) == AGGR_INIT_EXPR || TREE_CODE (t) == TARGET_EXPR)) @@ -7422,7 +7422,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, /* Allow any built-in function; if the expansion isn't constant, we'll deal with that then. */ && !fndecl_built_in_p (fun) - /* In C++2a, replaceable global allocation functions + /* In C++20, replaceable global allocation functions are constant expressions. */ && (!cxx_replaceable_global_alloc_fn (fun) || TREE_CODE (t) != CALL_EXPR @@ -7844,12 +7844,12 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, return false; case OBJ_TYPE_REF: - if (cxx_dialect >= cxx2a) - /* In C++2a virtual calls can be constexpr, don't give up yet. */ + if (cxx_dialect >= cxx20) + /* In C++20 virtual calls can be constexpr, don't give up yet. */ return true; else if (flags & tf_error) error_at (loc, - "virtual functions cannot be %<constexpr%> before C++2a"); + "virtual functions cannot be %<constexpr%> before C++20"); return false; case TYPEID_EXPR: @@ -7857,7 +7857,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, class type can be constexpr. */ { tree e = TREE_OPERAND (t, 0); - if (cxx_dialect < cxx2a + if (cxx_dialect < cxx20 && strict && !TYPE_P (e) && !type_dependent_expression_p (e) @@ -8153,7 +8153,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, return true; case COND_EXPR: - if (COND_EXPR_IS_VEC_DELETE (t) && cxx_dialect < cxx2a) + if (COND_EXPR_IS_VEC_DELETE (t) && cxx_dialect < cxx20) { if (flags & tf_error) error_at (loc, "%<delete[]%> is not a constant expression"); diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 4ad17f3..3a17005 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -1473,7 +1473,7 @@ finish_shorthand_constraint (tree decl, tree constr) The standard behavior cannot be overridden by -fconcepts-ts. */ bool variadic_concept_p = template_parameter_pack_p (proto); bool declared_pack_p = template_parameter_pack_p (decl); - bool apply_to_each_p = (cxx_dialect >= cxx2a) ? true : !variadic_concept_p; + bool apply_to_each_p = (cxx_dialect >= cxx20) ? true : !variadic_concept_p; /* Get the argument and overload used for the requirement and adjust it if we're going to expand later. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1b6a567..37ab481 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -928,7 +928,7 @@ static bool function_requirements_equivalent_p (tree newfn, tree oldfn) { /* In the concepts TS, the combined constraints are compared. */ - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) { tree ci1 = get_constraints (oldfn); tree ci2 = get_constraints (newfn); @@ -5570,7 +5570,7 @@ grok_reference_init (tree decl, tree type, tree init, int flags) if (TREE_TYPE (init) == NULL_TREE && CP_AGGREGATE_TYPE_P (ttype) && !DECL_DECOMPOSITION_P (decl) - && (cxx_dialect >= cxx2a)) + && (cxx_dialect >= cxx20)) { /* We don't know yet if we should treat const A& r(1) as const A& r{1}. */ @@ -5896,7 +5896,7 @@ check_for_uninitialized_const_var (tree decl, bool constexpr_context_p, && (CP_TYPE_CONST_P (type) /* C++20 permits trivial default initialization in constexpr context (P1331R2). */ - || (cxx_dialect < cxx2a + || (cxx_dialect < cxx20 && (constexpr_context_p || var_in_constexpr_fn (decl)))) && !DECL_NONTRIVIALLY_INITIALIZED_P (decl)) @@ -5907,7 +5907,7 @@ check_for_uninitialized_const_var (tree decl, bool constexpr_context_p, bool show_notes = true; - if (!constexpr_context_p || cxx_dialect >= cxx2a) + if (!constexpr_context_p || cxx_dialect >= cxx20) { if (CP_TYPE_CONST_P (type)) { @@ -6721,7 +6721,7 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups) && TREE_TYPE (init) == NULL_TREE && TREE_CODE (type) == ARRAY_TYPE && !DECL_DECOMPOSITION_P (decl) - && (cxx_dialect >= cxx2a)) + && (cxx_dialect >= cxx20)) { /* [dcl.init.string] "An array of ordinary character type [...] can be initialized by an ordinary string literal [...] by an @@ -7186,14 +7186,14 @@ notice_forced_label_r (tree *tp, int *walk_subtrees, void *) return NULL_TREE; } -/* Return true if DECL has either a trivial destructor, or for C++2A +/* Return true if DECL has either a trivial destructor, or for C++20 is constexpr and has a constexpr destructor. */ static bool decl_maybe_constant_destruction (tree decl, tree type) { return (TYPE_HAS_TRIVIAL_DESTRUCTOR (type) - || (cxx_dialect >= cxx2a + || (cxx_dialect >= cxx20 && VAR_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl) && type_has_constexpr_destructor (strip_array_types (type)))); @@ -7253,7 +7253,7 @@ omp_declare_variant_finalize_one (tree decl, tree attr) if (idk == CP_ID_KIND_UNQUALIFIED || idk == CP_ID_KIND_TEMPLATE_ID) { if (identifier_p (variant) - /* In C++2A, we may need to perform ADL for a template + /* In C++20, we may need to perform ADL for a template name. */ || (TREE_CODE (variant) == TEMPLATE_ID_EXPR && identifier_p (TREE_OPERAND (variant, 0)))) @@ -11648,13 +11648,13 @@ grokdeclarator (const cp_declarator *declarator, storage_class = sc_none; staticp = 0; } - if (constexpr_p && cxx_dialect < cxx2a) + if (constexpr_p && cxx_dialect < cxx20) { gcc_rich_location richloc (declspecs->locations[ds_virtual]); richloc.add_range (declspecs->locations[ds_constexpr]); pedwarn (&richloc, OPT_Wpedantic, "member %qD can be declared both " - "%<virtual%> and %<constexpr%> only in %<-std=c++2a%> or " - "%<-std=gnu++2a%>", dname); + "%<virtual%> and %<constexpr%> only in %<-std=c++20%> or " + "%<-std=gnu++20%>", dname); } } friendp = decl_spec_seq_has_spec_p (declspecs, ds_friend); @@ -11741,10 +11741,10 @@ grokdeclarator (const cp_declarator *declarator, if (consteval_p) error_at (declspecs->locations[ds_consteval], "structured " "binding declaration cannot be %qs", "consteval"); - if (thread_p && cxx_dialect < cxx2a) + if (thread_p && cxx_dialect < cxx20) pedwarn (declspecs->locations[ds_thread], 0, "structured binding declaration can be %qs only in " - "%<-std=c++2a%> or %<-std=gnu++2a%>", + "%<-std=c++20%> or %<-std=gnu++20%>", declspecs->gnu_thread_keyword_p ? "__thread" : "thread_local"); if (concept_p) @@ -11763,10 +11763,10 @@ grokdeclarator (const cp_declarator *declarator, "register"); break; case sc_static: - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) pedwarn (loc, 0, "structured binding declaration can be %qs only in " - "%<-std=c++2a%> or %<-std=gnu++2a%>", "static"); + "%<-std=c++20%> or %<-std=gnu++20%>", "static"); break; case sc_extern: error_at (loc, "structured binding declaration cannot be %qs", @@ -13206,11 +13206,11 @@ grokdeclarator (const cp_declarator *declarator, "a destructor cannot be %qs", "concept"); return error_mark_node; } - if (constexpr_p && cxx_dialect < cxx2a) + if (constexpr_p && cxx_dialect < cxx20) { error_at (declspecs->locations[ds_constexpr], "%<constexpr%> destructors only available" - " with %<-std=c++2a%> or %<-std=gnu++2a%>"); + " with %<-std=c++20%> or %<-std=gnu++20%>"); return error_mark_node; } if (consteval_p) diff --git a/gcc/cp/init.c b/gcc/cp/init.c index e2e547a..56715d6 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -812,7 +812,7 @@ perform_member_init (tree member, tree init) if (init && TREE_CODE (init) == TREE_LIST && (DIRECT_LIST_INIT_P (TREE_VALUE (init)) /* FIXME C++20 parenthesized aggregate init (PR 92812). */ - || !(/* cxx_dialect >= cxx2a ? CP_AGGREGATE_TYPE_P (type) */ + || !(/* cxx_dialect >= cxx20 ? CP_AGGREGATE_TYPE_P (type) */ /* : */CLASS_TYPE_P (type)))) init = build_x_compound_expr_from_list (init, ELK_MEM_INIT, tf_warning_or_error); @@ -2909,7 +2909,7 @@ build_new_constexpr_heap_type (tree elt_type, tree cookie_size, tree full_size) static tree maybe_wrap_new_for_constexpr (tree alloc_call, tree elt_type, tree cookie_size) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) return alloc_call; if (current_function_decl != NULL_TREE @@ -3611,7 +3611,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts, means allocate an int, and initialize it with 10. In C++20, also handle `new A(1, 2)'. */ - if (cxx_dialect >= cxx2a + if (cxx_dialect >= cxx20 && AGGREGATE_TYPE_P (type) && (*init)->length () > 1) { diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index b55c2f8..c94fe8e 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -702,7 +702,7 @@ add_default_capture (tree lambda_stack, tree id, tree initializer) initializer = convert_from_reference (var); /* Warn about deprecated implicit capture of this via [=]. */ - if (cxx_dialect >= cxx2a + if (cxx_dialect >= cxx20 && this_capture_p && LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda) == CPLD_COPY) { diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 37282d5..8a69bc4 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -229,7 +229,7 @@ init_reswords (void) if (cxx_dialect < cxx11) mask |= D_CXX11; - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) mask |= D_CXX20; if (!flag_concepts) mask |= D_CXX_CONCEPTS; diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 47f96aa..3f8842b 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1095,10 +1095,10 @@ early_check_defaulted_comparison (tree fn) ctx = DECL_FRIEND_CONTEXT (fn); bool ok = true; - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) { - error_at (loc, "defaulted %qD only available with %<-std=c++2a%> or " - "%<-std=gnu++2a%>", fn); + error_at (loc, "defaulted %qD only available with %<-std=c++20%> or " + "%<-std=gnu++20%>", fn); return false; } @@ -1802,7 +1802,7 @@ constructible_expr (tree to, tree from) const int len = list_length (from); if (len > 1) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) /* Too many initializers. */ return error_mark_node; @@ -1831,7 +1831,7 @@ constructible_expr (tree to, tree from) /* If t(e) didn't work, maybe t{e} will. */ if (expr == NULL_TREE && len == 1 - && cxx_dialect >= cxx2a) + && cxx_dialect >= cxx20) { from = build_constructor_single (init_list_type_node, NULL_TREE, from); @@ -2074,7 +2074,7 @@ walk_field_subobs (tree fields, special_function_kind sfk, tree fnname, be constexpr, every member must have a user-provided default constructor or an explicit initializer. */ if (constexpr_p - && cxx_dialect < cxx2a + && cxx_dialect < cxx20 && !CLASS_TYPE_P (mem_type) && TREE_CODE (DECL_CONTEXT (field)) != UNION_TYPE) { @@ -2226,11 +2226,11 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, /* "The closure type associated with a lambda-expression has a deleted default constructor and a deleted copy assignment operator." This is diagnosed in maybe_explain_implicit_delete. - In C++2a, only lambda-expressions with lambda-captures have those + In C++20, only lambda-expressions with lambda-captures have those deleted. */ if (LAMBDA_TYPE_P (ctype) && (sfk == sfk_constructor || sfk == sfk_copy_assignment) - && (cxx_dialect < cxx2a + && (cxx_dialect < cxx20 || LAMBDA_EXPR_CAPTURE_LIST (CLASSTYPE_LAMBDA_EXPR (ctype)) || LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (CLASSTYPE_LAMBDA_EXPR (ctype)) != CPLD_NONE)) @@ -2274,7 +2274,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, if (constexpr_p) *constexpr_p = (SFK_CTOR_P (sfk) || (SFK_ASSIGN_P (sfk) && cxx_dialect >= cxx14) - || (SFK_DTOR_P (sfk) && cxx_dialect >= cxx2a)); + || (SFK_DTOR_P (sfk) && cxx_dialect >= cxx20)); bool expected_trivial = type_has_trivial_fn (ctype, sfk); if (trivial_p) diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 9b68b15..4928b60 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -5635,19 +5635,19 @@ get_std_name_hint (const char *name) {"make_any", "<any>", cxx17}, /* <array>. */ {"array", "<array>", cxx11}, - {"to_array", "<array>", cxx2a}, + {"to_array", "<array>", cxx20}, /* <atomic>. */ {"atomic", "<atomic>", cxx11}, {"atomic_flag", "<atomic>", cxx11}, - {"atomic_ref", "<atomic>", cxx2a}, + {"atomic_ref", "<atomic>", cxx20}, /* <bitset>. */ {"bitset", "<bitset>", cxx11}, /* <compare> */ - {"weak_equality", "<compare>", cxx2a}, - {"strong_equality", "<compare>", cxx2a}, - {"partial_ordering", "<compare>", cxx2a}, - {"weak_ordering", "<compare>", cxx2a}, - {"strong_ordering", "<compare>", cxx2a}, + {"weak_equality", "<compare>", cxx20}, + {"strong_equality", "<compare>", cxx20}, + {"partial_ordering", "<compare>", cxx20}, + {"weak_ordering", "<compare>", cxx20}, + {"strong_ordering", "<compare>", cxx20}, /* <complex>. */ {"complex", "<complex>", cxx98}, {"complex_literals", "<complex>", cxx14}, @@ -5670,17 +5670,17 @@ get_std_name_hint (const char *name) {"ofstream", "<fstream>", cxx98}, /* <functional>. */ {"bind", "<functional>", cxx11}, - {"bind_front", "<functional>", cxx2a}, + {"bind_front", "<functional>", cxx20}, {"function", "<functional>", cxx11}, {"hash", "<functional>", cxx11}, {"invoke", "<functional>", cxx17}, {"mem_fn", "<functional>", cxx11}, {"not_fn", "<functional>", cxx17}, {"reference_wrapper", "<functional>", cxx11}, - {"unwrap_reference", "<functional>", cxx2a}, - {"unwrap_reference_t", "<functional>", cxx2a}, - {"unwrap_ref_decay", "<functional>", cxx2a}, - {"unwrap_ref_decay_t", "<functional>", cxx2a}, + {"unwrap_reference", "<functional>", cxx20}, + {"unwrap_reference_t", "<functional>", cxx20}, + {"unwrap_ref_decay", "<functional>", cxx20}, + {"unwrap_ref_decay_t", "<functional>", cxx20}, /* <future>. */ {"async", "<future>", cxx11}, {"future", "<future>", cxx11}, @@ -5763,7 +5763,7 @@ get_std_name_hint (const char *name) {"shared_mutex", "<shared_mutex>", cxx17}, {"shared_timed_mutex", "<shared_mutex>", cxx14}, /* <source_location>. */ - {"source_location", "<source_location>", cxx2a}, + {"source_location", "<source_location>", cxx20}, /* <sstream>. */ {"basic_stringbuf", "<sstream>", cxx98}, {"basic_istringstream", "<sstream>", cxx98}, @@ -5778,7 +5778,7 @@ get_std_name_hint (const char *name) {"basic_string", "<string>", cxx98}, {"string", "<string>", cxx98}, {"wstring", "<string>", cxx98}, - {"u8string", "<string>", cxx2a}, + {"u8string", "<string>", cxx20}, {"u16string", "<string>", cxx11}, {"u32string", "<string>", cxx11}, /* <string_view>. */ @@ -5804,10 +5804,10 @@ get_std_name_hint (const char *name) {"enable_if_t", "<type_traits>", cxx14}, {"invoke_result", "<type_traits>", cxx17}, {"invoke_result_t", "<type_traits>", cxx17}, - {"remove_cvref", "<type_traits>", cxx2a}, - {"remove_cvref_t", "<type_traits>", cxx2a}, - {"type_identity", "<type_traits>", cxx2a}, - {"type_identity_t", "<type_traits>", cxx2a}, + {"remove_cvref", "<type_traits>", cxx20}, + {"remove_cvref_t", "<type_traits>", cxx20}, + {"type_identity", "<type_traits>", cxx20}, + {"type_identity_t", "<type_traits>", cxx20}, {"void_t", "<type_traits>", cxx17}, {"conjunction", "<type_traits>", cxx17}, {"conjunction_v", "<type_traits>", cxx17}, @@ -5859,8 +5859,8 @@ get_cxx_dialect_name (enum cxx_dialect dialect) return "C++14"; case cxx17: return "C++17"; - case cxx2a: - return "C++2a"; + case cxx20: + return "C++20"; } } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f1ddef2..bc1ee21 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1809,7 +1809,7 @@ enum constexpr. */ CP_PARSER_FLAGS_ONLY_TYPE_OR_CONSTEXPR = 0x8, /* When parsing a decl-specifier-seq, only allow mutable, constexpr or - for C++2A consteval. */ + for C++20 consteval. */ CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR = 0x10, /* When parsing a decl-specifier-seq, allow missing typename. */ CP_PARSER_FLAGS_TYPENAME_OPTIONAL = 0x20, @@ -3369,11 +3369,11 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree id, && id_equal (id, "thread_local")) inform (location, "C++11 %<thread_local%> only available with " "%<-std=c++11%> or %<-std=gnu++11%>"); - else if (cxx_dialect < cxx2a && id == ridpointers[(int)RID_CONSTINIT]) + else if (cxx_dialect < cxx20 && id == ridpointers[(int)RID_CONSTINIT]) inform (location, "C++20 %<constinit%> only available with " - "%<-std=c++2a%> or %<-std=gnu++2a%>"); + "%<-std=c++20%> or %<-std=gnu++20%>"); else if (!flag_concepts && id == ridpointers[(int)RID_CONCEPT]) - inform (location, "%<concept%> only available with %<-std=c++2a%> or " + inform (location, "%<concept%> only available with %<-std=c++20%> or " "%<-fconcepts%>"); else if (!flag_concepts && id == ridpointers[(int)RID_REQUIRES]) inform (location, "%<requires%> only available with %<-std=c++2a%> or " @@ -7362,7 +7362,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, || idk == CP_ID_KIND_TEMPLATE_ID) { if (identifier_p (postfix_expression) - /* In C++2A, we may need to perform ADL for a template + /* In C++20, we may need to perform ADL for a template name. */ || (TREE_CODE (postfix_expression) == TEMPLATE_ID_EXPR && identifier_p (TREE_OPERAND (postfix_expression, 0)))) @@ -10510,7 +10510,7 @@ cp_parser_lambda_expression (cp_parser* parser) LAMBDA_EXPR_LOCATION (lambda_expr) = token->location; - if (cxx_dialect >= cxx2a) + if (cxx_dialect >= cxx20) /* C++20 allows lambdas in unevaluated context. */; else if (cp_unevaluated_operand) { @@ -10518,7 +10518,7 @@ cp_parser_lambda_expression (cp_parser* parser) { error_at (LAMBDA_EXPR_LOCATION (lambda_expr), "lambda-expression in unevaluated context" - " only available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + " only available with %<-std=c++20%> or %<-std=gnu++20%>"); token->error_reported = true; } ok = false; @@ -10528,7 +10528,7 @@ cp_parser_lambda_expression (cp_parser* parser) if (!token->error_reported) { error_at (token->location, "lambda-expression in template-argument" - " only available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + " only available with %<-std=c++20%> or %<-std=gnu++20%>"); token->error_reported = true; } ok = false; @@ -10714,7 +10714,7 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_THIS)) { location_t loc = cp_lexer_peek_token (parser->lexer)->location; - if (cxx_dialect < cxx2a + if (cxx_dialect < cxx20 && LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr) == CPLD_COPY) pedwarn (loc, 0, "explicit by-copy capture of %<this%> redundant " "with by-copy capture default"); @@ -10774,9 +10774,9 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr) if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)) { ellipsis_loc = cp_lexer_peek_token (parser->lexer)->location; - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) pedwarn (ellipsis_loc, 0, "pack init-capture only available with " - "%<-std=c++2a%> or %<-std=gnu++2a%>"); + "%<-std=c++20%> or %<-std=gnu++20%>"); cp_lexer_consume_token (parser->lexer); init_pack_expansion = true; } @@ -10993,10 +10993,10 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) pedwarn (parser->lexer->next_token->location, 0, "lambda templates are only available with " "%<-std=c++14%> or %<-std=gnu++14%>"); - else if (cxx_dialect < cxx2a) + else if (cxx_dialect < cxx20) pedwarn (parser->lexer->next_token->location, OPT_Wpedantic, "lambda templates are only available with " - "%<-std=c++2a%> or %<-std=gnu++2a%>"); + "%<-std=c++20%> or %<-std=gnu++20%>"); cp_lexer_consume_token (parser->lexer); @@ -11030,7 +11030,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr) bool is_consteval = false; /* For C++20, before parsing the parameter list check if there is a consteval specifier in the corresponding decl-specifier-seq. */ - if (cxx_dialect >= cxx2a) + if (cxx_dialect >= cxx20) { for (size_t n = cp_parser_skip_balanced_tokens (parser, 1); cp_lexer_nth_token_is (parser->lexer, n, CPP_KEYWORD); n++) @@ -12970,11 +12970,11 @@ cp_parser_init_statement (cp_parser *parser, tree *decl) /* That didn't work, try to parse it as an expression-statement. */ cp_parser_expression_statement (parser, NULL_TREE); - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) { pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0, "range-based %<for%> loops with initializer only " - "available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "available with %<-std=c++20%> or %<-std=gnu++20%>"); *decl = error_mark_node; } } @@ -14486,7 +14486,7 @@ cp_parser_storage_class_specifier_opt (cp_parser* parser) virtual explicit - C++2A Extension: + C++20 Extension: explicit(constant-expression) Returns an IDENTIFIER_NODE corresponding to the keyword used. @@ -14530,10 +14530,10 @@ cp_parser_function_specifier_opt (cp_parser* parser, parser->type_definition_forbidden_message = G_("types may not be defined in explicit-specifier"); - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) pedwarn (token->location, 0, - "%<explicit(bool)%> only available with %<-std=c++2a%> " - "or %<-std=gnu++2a%>"); + "%<explicit(bool)%> only available with %<-std=c++20%> " + "or %<-std=gnu++20%>"); /* Parse the constant-expression. */ expr = cp_parser_constant_expression (parser); @@ -16682,12 +16682,12 @@ cp_parser_template_id (cp_parser *parser, /* This didn't go well. */ if (TREE_CODE (templ) == FUNCTION_DECL) { - /* C++2A says that "function-name < a;" is now ill-formed. */ + /* C++20 says that "function-name < a;" is now ill-formed. */ if (cp_parser_error_occurred (parser)) { error_at (token->location, "invalid template-argument-list"); inform (token->location, "function name as the left hand " - "operand of %<<%> is ill-formed in C++2a; wrap the " + "operand of %<<%> is ill-formed in C++20; wrap the " "function name in %<()%>"); } else @@ -17391,7 +17391,7 @@ cp_parser_template_argument (cp_parser* parser) else { /* In C++20, we can encounter a braced-init-list. */ - if (cxx_dialect >= cxx2a + if (cxx_dialect >= cxx20 && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { bool expr_non_constant_p; @@ -18112,7 +18112,7 @@ cp_parser_simple_type_specifier (cp_parser* parser, { bool qualified_p; bool global_p; - const bool typename_p = (cxx_dialect >= cxx2a + const bool typename_p = (cxx_dialect >= cxx20 && (flags & CP_PARSER_FLAGS_TYPENAME_OPTIONAL)); /* Don't gobble tokens or issue error messages if this is an @@ -18378,7 +18378,7 @@ cp_parser_placeholder_type_specifier (cp_parser *parser, location_t loc, /* As per the standard, require auto or decltype(auto), except in some cases (template parameter lists, -fconcepts-ts enabled). */ cp_token *placeholder = NULL, *close_paren = NULL; - if (cxx_dialect >= cxx2a) + if (cxx_dialect >= cxx20) { if (cp_lexer_next_token_is_keyword (parser->lexer, RID_AUTO)) placeholder = cp_lexer_consume_token (parser->lexer); @@ -19631,10 +19631,10 @@ cp_parser_namespace_definition (cp_parser* parser) RID_INLINE); if (nested_inline_p && nested_definition_count != 0) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) pedwarn (cp_lexer_peek_token (parser->lexer)->location, OPT_Wpedantic, "nested inline namespace definitions only " - "available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "available with %<-std=c++20%> or %<-std=gnu++20%>"); cp_lexer_consume_token (parser->lexer); } @@ -20187,13 +20187,13 @@ cp_parser_asm_definition (cp_parser* parser) /* Look for the `asm' keyword. */ cp_parser_require_keyword (parser, RID_ASM, RT_ASM); - /* In C++2a, unevaluated inline assembly is permitted in constexpr + /* In C++20, unevaluated inline assembly is permitted in constexpr functions. */ if (parser->in_function_body && DECL_DECLARED_CONSTEXPR_P (current_function_decl) - && (cxx_dialect < cxx2a)) + && (cxx_dialect < cxx20)) pedwarn (asm_loc, 0, "%<asm%> in %<constexpr%> function only available " - "with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "with %<-std=c++20%> or %<-std=gnu++20%>"); /* Handle the asm-qualifier-list. */ location_t volatile_loc = UNKNOWN_LOCATION; @@ -21600,7 +21600,7 @@ cp_parser_direct_declarator (cp_parser* parser, - it is a decl-specifier of the decl-specifier-seq of a parameter-declaration in a declarator of a function or function template declaration, ... */ - if (cxx_dialect >= cxx2a + if (cxx_dialect >= cxx20 && (flags & CP_PARSER_FLAGS_TYPENAME_OPTIONAL) && declarator->kind == cdk_id && !at_class_scope_p () @@ -23082,16 +23082,16 @@ cp_parser_ctor_initializer_opt_and_function_body (cp_parser *parser, if (in_function_try_block && DECL_DECLARED_CONSTEXPR_P (current_function_decl) - && cxx_dialect < cxx2a) + && cxx_dialect < cxx20) { if (DECL_CONSTRUCTOR_P (current_function_decl)) pedwarn (input_location, 0, "function-try-block body of %<constexpr%> constructor only " - "available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "available with %<-std=c++20%> or %<-std=gnu++20%>"); else pedwarn (input_location, 0, "function-try-block body of %<constexpr%> function only " - "available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "available with %<-std=c++20%> or %<-std=gnu++20%>"); } /* Begin the function body. */ @@ -23351,7 +23351,7 @@ cp_parser_array_designator_p (cp_parser *parser) initializer-clause ... [opt] initializer-list , initializer-clause ... [opt] - C++2A Extension: + C++20 Extension: designated-initializer-list: designated-initializer-clause @@ -23403,8 +23403,8 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p, bool clause_non_constant_p; location_t loc = cp_lexer_peek_token (parser->lexer)->location; - /* Handle the C++2A syntax, '. id ='. */ - if ((cxx_dialect >= cxx2a + /* Handle the C++20 syntax, '. id ='. */ + if ((cxx_dialect >= cxx20 || cp_parser_allow_gnu_extensions_p (parser)) && cp_lexer_next_token_is (parser->lexer, CPP_DOT) && cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_NAME @@ -23412,10 +23412,10 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p, || (cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_OPEN_BRACE))) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) pedwarn (loc, OPT_Wpedantic, "C++ designated initializers only available with " - "%<-std=c++2a%> or %<-std=gnu++2a%>"); + "%<-std=c++20%> or %<-std=gnu++20%>"); /* Consume the `.'. */ cp_lexer_consume_token (parser->lexer); /* Consume the identifier. */ @@ -23482,7 +23482,7 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p, first_designator = designator; first_p = false; } - else if (cxx_dialect >= cxx2a + else if (cxx_dialect >= cxx20 && first_designator != error_mark_node && (!first_designator != !designator)) { @@ -23490,7 +23490,7 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p, "or none of them should be"); first_designator = error_mark_node; } - else if (cxx_dialect < cxx2a && !first_designator) + else if (cxx_dialect < cxx20 && !first_designator) first_designator = designator; /* Parse the initializer. */ @@ -23509,7 +23509,7 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p, /* Consume the `...'. */ cp_lexer_consume_token (parser->lexer); - if (designator && cxx_dialect >= cxx2a) + if (designator && cxx_dialect >= cxx20) error_at (loc, "%<...%> not allowed in designated initializer list"); @@ -25111,7 +25111,7 @@ cp_parser_member_declaration (cp_parser* parser) width = cp_parser_constant_expression (parser, false, NULL, cxx_dialect >= cxx11); - /* In C++2A and as extension for C++11 and above we allow + /* In C++20 and as extension for C++11 and above we allow default member initializers for bit-fields. */ initializer = NULL_TREE; if (cxx_dialect >= cxx11 @@ -25121,12 +25121,12 @@ cp_parser_member_declaration (cp_parser* parser) { location_t loc = cp_lexer_peek_token (parser->lexer)->location; - if (cxx_dialect < cxx2a + if (cxx_dialect < cxx20 && identifier != NULL_TREE) pedwarn (loc, 0, "default member initializers for bit-fields " - "only available with %<-std=c++2a%> or " - "%<-std=gnu++2a%>"); + "only available with %<-std=c++20%> or " + "%<-std=gnu++20%>"); initializer = cp_parser_save_nsdmi (parser); if (identifier == NULL_TREE) @@ -26084,10 +26084,10 @@ cp_parser_try_block (cp_parser* parser) cp_parser_require_keyword (parser, RID_TRY, RT_TRY); if (parser->in_function_body && DECL_DECLARED_CONSTEXPR_P (current_function_decl) - && cxx_dialect < cxx2a) + && cxx_dialect < cxx20) pedwarn (input_location, 0, "%<try%> in %<constexpr%> function only " - "available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "available with %<-std=c++20%> or %<-std=gnu++20%>"); try_block = begin_try_block (); cp_parser_compound_statement (parser, NULL, BCS_TRY_BLOCK, false); @@ -27705,7 +27705,7 @@ cp_parser_requires_clause_opt (cp_parser *parser, bool lambda_p) { error_at (cp_lexer_peek_token (parser->lexer)->location, "%<requires%> only available with " - "%<-std=c++2a%> or %<-fconcepts%>"); + "%<-std=c++20%> or %<-fconcepts%>"); /* Parse and discard the requires-clause. */ cp_lexer_consume_token (parser->lexer); cp_parser_constraint_expression (parser); @@ -28035,7 +28035,7 @@ cp_parser_compound_requirement (cp_parser *parser) bool saved_result_type_constraint_p = parser->in_result_type_constraint_p; parser->in_result_type_constraint_p = true; - /* C++2a allows either a type-id or a type-constraint. Parsing + /* C++20 allows either a type-id or a type-constraint. Parsing a type-id will subsume the parsing for a type-constraint but allow for more syntactic forms (e.g., const C<T>*). */ type = cp_parser_trailing_type_id (parser); @@ -29049,7 +29049,7 @@ cp_parser_template_declaration_after_parameters (cp_parser* parser, else if (cxx_dialect >= cxx11 && cp_lexer_next_token_is_keyword (parser->lexer, RID_USING)) decl = cp_parser_alias_declaration (parser); - else if (cxx_dialect >= cxx2a /* Implies flag_concept. */ + else if (cxx_dialect >= cxx20 /* Implies flag_concept. */ && cp_lexer_next_token_is_keyword (parser->lexer, RID_CONCEPT) && !cp_lexer_nth_token_is_keyword (parser->lexer, 2, RID_BOOL)) /* Allow 'concept bool' to be handled as per the TS. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7911293..f0cb7a2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3490,7 +3490,7 @@ template_heads_equivalent_p (const_tree tmpl1, const_tree tmpl2) tree parms2 = DECL_TEMPLATE_PARMS (tmpl2); /* Don't change the matching rules for pre-C++20. */ - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) return comp_template_parms (parms1, parms2); /* ... have the same number of template parameters, and their @@ -5776,7 +5776,7 @@ push_template_decl_real (tree decl, bool is_friend) else if (VAR_P (decl)) /* C++14 variable template. */; else if (TREE_CODE (decl) == CONCEPT_DECL) - /* C++2a concept definitions. */; + /* C++20 concept definitions. */; else { error ("template declaration of %q#D", decl); @@ -9070,7 +9070,7 @@ coerce_innermost_template_parms (tree parms, static bool class_nttp_const_wrapper_p (tree t) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) return false; return (TREE_CODE (t) == VIEW_CONVERT_EXPR && CP_TYPE_CONST_P (TREE_TYPE (t)) @@ -26137,11 +26137,11 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) return false; else if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) { - if (CLASS_PLACEHOLDER_TEMPLATE (type) && cxx_dialect < cxx2a) + if (CLASS_PLACEHOLDER_TEMPLATE (type) && cxx_dialect < cxx20) { if (complain & tf_error) error ("non-type template parameters of deduced class type only " - "available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "available with %<-std=c++20%> or %<-std=gnu++20%>"); return true; } return false; @@ -26159,11 +26159,11 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) return false; else if (CLASS_TYPE_P (type)) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) { if (complain & tf_error) error ("non-type template parameters of class type only available " - "with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "with %<-std=c++20%> or %<-std=gnu++20%>"); return true; } if (dependent_type_p (type)) @@ -28383,7 +28383,7 @@ is_spec_or_derived (tree etype, tree tmpl) static tree maybe_aggr_guide (tree tmpl, tree init, vec<tree,va_gc> *args) { - if (cxx_dialect < cxx2a) + if (cxx_dialect < cxx20) return NULL_TREE; if (init == NULL_TREE) @@ -28750,12 +28750,12 @@ do_class_deduction (tree ptype, tree tmpl, tree init, error ("non-deducible template %qT used without template arguments", tmpl); return error_mark_node; } - else if (cxx_dialect < cxx2a && DECL_ALIAS_TEMPLATE_P (tmpl)) + else if (cxx_dialect < cxx20 && DECL_ALIAS_TEMPLATE_P (tmpl)) { /* This doesn't affect conforming C++17 code, so just pedwarn. */ if (complain & tf_warning_or_error) pedwarn (input_location, 0, "alias template deduction only available " - "with %<-std=c++2a%> or %<-std=gnu++2a%>"); + "with %<-std=c++20%> or %<-std=gnu++20%>"); } if (init && TREE_TYPE (init) == ptype) diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index d526a63..2090cbf 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -691,7 +691,7 @@ build_cplus_new (tree type, tree init, tsubst_flags_t complain) it can produce a { }. */ if (BRACE_ENCLOSED_INITIALIZER_P (init)) { - gcc_assert (cxx_dialect >= cxx2a); + gcc_assert (cxx_dialect >= cxx20); return finish_compound_literal (type, init, complain); } @@ -4599,7 +4599,7 @@ handle_nodiscard_attribute (tree *node, tree name, tree args, return NULL_TREE; } -/* Handle a C++2a "no_unique_address" attribute; arguments as in +/* Handle a C++20 "no_unique_address" attribute; arguments as in struct attribute_spec.handler. */ static tree handle_no_unique_addr_attribute (tree* node, diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index d407e4c..af84c25 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1102,7 +1102,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, return ok; } -/* True iff TYPE is a C++2a "ordinary" character type. */ +/* True iff TYPE is a C++20 "ordinary" character type. */ bool ordinary_char_type_p (tree type) @@ -2236,7 +2236,7 @@ build_m_component_ref (tree datum, tree component, tsubst_flags_t complain) { /* 5.5/6: In a .* expression whose object expression is an rvalue, the program is ill-formed if the second operand is a pointer to member - function with ref-qualifier & (for C++2A: unless its cv-qualifier-seq + function with ref-qualifier & (for C++20: unless its cv-qualifier-seq is const). In a .* expression whose object expression is an lvalue, the program is ill-formed if the second operand is a pointer to member function with ref-qualifier &&. */ @@ -2261,12 +2261,12 @@ build_m_component_ref (tree datum, tree component, tsubst_flags_t complain) "an lvalue", ptrmem_type); return error_mark_node; } - else if (cxx_dialect < cxx2a) + else if (cxx_dialect < cxx20) { if (complain & tf_warning_or_error) pedwarn (input_location, OPT_Wpedantic, "pointer-to-member-function type %qT requires " - "an lvalue before C++2a", ptrmem_type); + "an lvalue before C++20", ptrmem_type); else return error_mark_node; } |