+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.
+
2020-05-12 Eric Botcazou <ebotcazou@adacore.com>
* c-ada-spec.c (dump_ads): Output pragma Warnings ("U"); on entry.
ObjC is like C except that D_OBJC and D_CXX_OBJC are not set
C++ --std=c++98: D_CONLY | D_CXX11 | D_CXX20 | D_OBJC
C++ --std=c++11: D_CONLY | D_CXX20 | D_OBJC
- C++ --std=c++2a: D_CONLY | D_OBJC
+ C++ --std=c++20: D_CONLY | D_OBJC
ObjC++ is like C++ except that D_OBJC is not set
If -fno-asm is used, D_ASM is added to the mask. If
cxx14,
/* C++17 */
cxx17,
- /* C++2a (C++20?) */
- cxx2a
+ /* C++20 */
+ cxx20
};
/* The C++ dialect being used. C++98 is the default. */
}
if (cxx_dialect > cxx17)
{
- /* Set feature test macros for C++2a. */
+ /* Set feature test macros for C++20. */
cpp_define (pfile, "__cpp_init_captures=201803L");
cpp_define (pfile, "__cpp_generic_lambdas=201707L");
cpp_define (pfile, "__cpp_designated_initializers=201707L");
}
if (flag_concepts)
{
- if (cxx_dialect >= cxx2a)
+ if (cxx_dialect >= cxx20)
cpp_define (pfile, "__cpp_concepts=201907L");
else
cpp_define (pfile, "__cpp_concepts=201507L");
static void set_std_cxx11 (int);
static void set_std_cxx14 (int);
static void set_std_cxx17 (int);
-static void set_std_cxx2a (int);
+static void set_std_cxx20 (int);
static void set_std_c89 (int, int);
static void set_std_c99 (int);
static void set_std_c11 (int);
set_std_cxx17 (code == OPT_std_c__17 /* ISO */);
break;
- case OPT_std_c__2a:
- case OPT_std_gnu__2a:
+ case OPT_std_c__20:
+ case OPT_std_gnu__20:
if (!preprocessing_asm_p)
- set_std_cxx2a (code == OPT_std_c__2a /* ISO */);
+ set_std_cxx20 (code == OPT_std_c__20 /* ISO */);
break;
case OPT_std_c90:
/* -Wcomma-subscript is enabled by default in C++20. */
SET_OPTION_IF_UNSET (&global_options, &global_options_set,
warn_comma_subscript,
- cxx_dialect >= cxx2a && warn_deprecated);
+ cxx_dialect >= cxx20 && warn_deprecated);
/* -Wvolatile is enabled by default in C++20. */
SET_OPTION_IF_UNSET (&global_options, &global_options_set, warn_volatile,
- cxx_dialect >= cxx2a && warn_deprecated);
+ cxx_dialect >= cxx20 && warn_deprecated);
/* Declone C++ 'structors if -Os. */
if (flag_declone_ctor_dtor == -1)
if (flag_sized_deallocation == -1)
flag_sized_deallocation = (cxx_dialect >= cxx14);
- /* char8_t support is new in C++2A. */
+ /* char8_t support is new in C++20. */
if (flag_char8_t == -1)
- flag_char8_t = (cxx_dialect >= cxx2a);
+ flag_char8_t = (cxx_dialect >= cxx20);
if (flag_extern_tls_init)
{
if (warn_return_type == -1 && c_dialect_cxx ())
warn_return_type = 1;
- /* C++2a is the final version of concepts. We still use -fconcepts
+ /* C++20 is the final version of concepts. We still use -fconcepts
to know when concepts are enabled. Note that -fconcepts-ts can
be used to include additional features, although modified to
work with the standard. */
- if (cxx_dialect >= cxx2a || flag_concepts_ts)
+ if (cxx_dialect >= cxx20 || flag_concepts_ts)
flag_concepts = 1;
else if (flag_concepts)
/* For -std=c++17 -fconcepts, imply -fconcepts-ts. */
/* Set the C++ 202a draft standard (without GNU extensions if ISO). */
static void
-set_std_cxx2a (int iso)
+set_std_cxx20 (int iso)
{
- cpp_set_lang (parse_in, iso ? CLK_CXX2A: CLK_GNUCXX2A);
+ cpp_set_lang (parse_in, iso ? CLK_CXX20: CLK_GNUCXX20);
flag_no_gnu_keywords = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
flag_isoc94 = 1;
flag_isoc99 = 1;
flag_isoc11 = 1;
- /* C++2a includes concepts. */
- cxx_dialect = cxx2a;
+ /* C++20 includes concepts. */
+ cxx_dialect = cxx20;
lang_hooks.name = "GNU C++17"; /* Pretend C++17 until standardization. */
}
|| maybe_ne (GET_MODE_BITSIZE (TYPE_MODE (type0)),
TYPE_PRECISION (type0))
|| !sanitize_flags_p (SANITIZE_SHIFT_BASE)
- /* In C++2a and later, shifts are well defined except when
+ /* In C++20 and later, shifts are well defined except when
the second operand is not within bounds. */
- || cxx_dialect >= cxx2a)
+ || cxx_dialect >= cxx20)
;
/* For signed x << y, in C99/C11, the following:
/* Warn if signed left shift overflows. We don't warn
about left-shifting 1 into the sign bit in C++14; cf.
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3367.html#1457>
- and don't warn for C++2a at all, as signed left shifts never
+ and don't warn for C++20 at all, as signed left shifts never
overflow.
LOC is a location of the shift; OP0 and OP1 are the operands.
Return true if an overflow is detected, false otherwise. */
unsigned int prec0 = TYPE_PRECISION (type0);
/* Left-hand operand must be signed. */
- if (TYPE_UNSIGNED (type0) || cxx_dialect >= cxx2a)
+ if (TYPE_UNSIGNED (type0) || cxx_dialect >= cxx20)
return false;
unsigned int min_prec = (wi::min_precision (wi::to_wide (op0), SIGNED)
Conform to the ISO 2017 C++ standard.
std=c++2a
-C++ ObjC++
+C++ ObjC++ Alias(std=c++20) Undocumented
Conform to the ISO 2020 C++ draft standard (experimental and incomplete support).
std=c++20
-C++ ObjC++ Alias(std=c++2a)
+C++ ObjC++
Conform to the ISO 2020 C++ draft standard (experimental and incomplete support).
std=c11
Conform to the ISO 2017 C++ standard with GNU extensions.
std=gnu++2a
-C++ ObjC++
+C++ ObjC++ Alias(std=gnu++20)
Conform to the ISO 2020 C++ draft standard with GNU extensions (experimental and incomplete support).
std=gnu++20
-C++ ObjC++ Alias(std=gnu++2a)
+C++ ObjC++
Conform to the ISO 2020 C++ draft standard with GNU extensions (experimental and incomplete support).
std=gnu11
+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
/* 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)
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. */
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);
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
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 ())
{
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));
}
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);
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))
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));
/* 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))
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;
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)
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)
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);
}
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);
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)
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)
{
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),
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.
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;
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))
/* 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
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:
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)
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");
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. */
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);
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}. */
&& (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))
bool show_notes = true;
- if (!constexpr_context_p || cxx_dialect >= cxx2a)
+ if (!constexpr_context_p || cxx_dialect >= cxx20)
{
if (CP_TYPE_CONST_P (type))
{
&& 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
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))));
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))))
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);
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)
"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",
"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)
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);
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
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)
{
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)
{
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;
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;
}
const int len = list_length (from);
if (len > 1)
{
- if (cxx_dialect < cxx2a)
+ if (cxx_dialect < cxx20)
/* Too many initializers. */
return error_mark_node;
/* 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);
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)
{
/* "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))
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)
{"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},
{"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},
{"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},
{"basic_string", "<string>", cxx98},
{"string", "<string>", cxx98},
{"wstring", "<string>", cxx98},
- {"u8string", "<string>", cxx2a},
+ {"u8string", "<string>", cxx20},
{"u16string", "<string>", cxx11},
{"u32string", "<string>", cxx11},
/* <string_view>. */
{"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},
return "C++14";
case cxx17:
return "C++17";
- case cxx2a:
- return "C++2a";
+ case cxx20:
+ return "C++20";
}
}
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,
&& 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 "
|| 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))))
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)
{
{
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;
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;
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");
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;
}
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);
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++)
/* 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;
}
}
virtual
explicit
- C++2A Extension:
+ C++20 Extension:
explicit(constant-expression)
Returns an IDENTIFIER_NODE corresponding to the keyword used.
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);
/* 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
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;
{
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
/* 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);
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);
}
/* 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;
- 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 ()
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. */
initializer-clause ... [opt]
initializer-list , initializer-clause ... [opt]
- C++2A Extension:
+ C++20 Extension:
designated-initializer-list:
designated-initializer-clause
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
|| (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. */
first_designator = designator;
first_p = false;
}
- else if (cxx_dialect >= cxx2a
+ else if (cxx_dialect >= cxx20
&& first_designator != error_mark_node
&& (!first_designator != !designator))
{
"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. */
/* 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");
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
{
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)
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);
{
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);
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);
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. */
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
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);
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))
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;
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))
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)
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)
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);
}
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,
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)
{
/* 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 &&. */
"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;
}
dw_die_ref tmpl_die = NULL;
const char *name = NULL;
- /* C++2a accepts class literals as template parameters, and var
+ /* C++20 accepts class literals as template parameters, and var
decls with initializers represent them. The VAR_DECLs would be
rejected, but we can take the DECL_INITIAL constructor and
attempt to expand it. */
// { dg-do compile { target c++11 } }
struct A {
- A () = delete; // { dg-message "declared here" "" { target c++2a } }
+ A () = delete; // { dg-message "declared here" "" { target c++20 } }
};
struct B {
B () = default;
int b = 0;
};
struct C {
- C (C&&) = default; // { dg-message "candidate" "" { target c++2a } }
+ C (C&&) = default; // { dg-message "candidate" "" { target c++20 } }
int c, d;
};
-A a {}; // { dg-error "use of deleted function" "" { target c++2a } }
-B b = {1}; // { dg-error "could not convert" "" { target { c++11_only || c++2a } } }
-C *c = new C {2, 3}; // { dg-error "no matching function for call to" "" { target c++2a } }
+A a {}; // { dg-error "use of deleted function" "" { target c++20 } }
+B b = {1}; // { dg-error "could not convert" "" { target { c++11_only || c++20 } } }
+C *c = new C {2, 3}; // { dg-error "no matching function for call to" "" { target c++20 } }
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wpedantic" }
// Test flexible array member. Here we're binding int[] to int[]. This worked
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wpedantic" }
int arr[1] = { 42 };
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T> void foo(T);
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
void f(const int(*)[]);
void fb(const int(*)[3]);
// PR c++/69531 - DR 1307, Overload resolution based on size of array init-list.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
int f(int, int const(&)[2]) { return 1; }
int f(double, int const(&)[2]) { return 2; }
// PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
using P = int *(*)[3];
using S = const int *const (*)[];
// PR c++/91364 - P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// As conversion/qual1.C, but with [].
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
A();
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
// Ranking of reference initialization conversions
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Ranking of reference initialization conversions
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
// Ranking of list-initialization sequences
int b(int (&&)[] ) { return 1; } // #1
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
// Ranking of reference initialization conversions
// PR c++/69531 - DR 1307, Overload resolution based on size of array init-list.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
int f(int const(&)[]) { return 1; }
int f(int const(&)[2]) { return 2; }
// PR c++/69531 - DR 1307, Overload resolution based on size of array init-list.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
// Example from [over.ics.rank].
int f(int (&&)[] ) { return 1; } // #1
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
int arr[1];
extern int arr2[];
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options -fdump-tree-gimple }
// { dg-final { scan-tree-dump-times "hot label" 5 "gimple" } }
// { dg-final { scan-tree-dump-times "cold label" 3 "gimple" } }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
bool b;
int main()
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
[[likely]] void f() { } // { dg-warning "function" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
int a, b, c;
// Testcase from P1816R0
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T>
struct S {
// Test that non-aggregates don't get the aggregate deduction.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-prune-output "no matching function" }
struct A { A(); };
// Testcase from P1814R0
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> struct identity { using type = T; };
template <class T> using identity_t = typename identity<T>::type;
// Test that a non-template deduction guide that doesn't match the alias is
// ignored.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> struct identity { using type = T; };
template <class T> using identity_t = typename identity<T>::type;
void
fn (int *a, int b, int c)
{
- a[b,c]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++2a } }
+ a[b,c]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++20 } }
a[(b,c)];
- a[(void) b, c]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++2a } }
+ a[(void) b, c]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++20 } }
a[((void) b, c)];
- a[(void) b, (void) c, (void) b, b]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++2a } }
+ a[(void) b, (void) c, (void) b, b]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++20 } }
a[((void) b, (void) c, (void) b, b)];
- a[S(), 10]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++2a } }
+ a[S(), 10]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++20 } }
a[(S(), 10)];
a[int{(1,2)}];
- a[int{(1,2)}, int{}]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++2a } }
+ a[int{(1,2)}, int{}]; // { dg-warning "top-level comma expression in array subscript is deprecated" "" { target c++20 } }
a[(int{(1,2)}, int{})];
}
// PR c++/91338 - P1161R3: Deprecate a[b,c].
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wno-comma-subscript" }
struct S {
// PR c++/91338 - P1161R3: Deprecate a[b,c].
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wno-deprecated" }
struct S {
// PR c++/91391 - bogus -Wcomma-subscript warning.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T, typename U>
int foo(T t, U u) { return t + u; }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Class = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T> struct A { };
template <typename T> concept int_type = __is_same_as (T, int);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T> struct A { };
template <typename T> concept int_type = __is_same_as (T, int);
// PR c++/93377
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct empty
{};
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Class = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <cmath>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> concept has_mem_type = requires { typename T::type; };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
// PR c++/94597
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename b, typename c> concept d = requires(b e) { e.operator c(); };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Tests constrained decltype(auto).
// PR c++/66092
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T, typename U, typename... Args>
concept Similar = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-final { scan-assembler "_Z1gI1XEvT_" } }
// { dg-final { scan-assembler "_Z1gI1YEvT_" } }
// { dg-final { scan-assembler "_Z1gIiEvT_" } }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <cassert>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <cassert>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <cassert>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
struct A {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#ifndef __cpp_concepts
#error __cpp_concepts not defined
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Type = true;
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#define assert(E) if (!(E)) __builtin_abort();
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept type = true;
// Testcase from [expr.prim.id]/5
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T> struct A {
static void f(int) requires false;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Eq = requires(T t) { t == t; }; // { dg-message "in requirements" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Eq = requires(T t) { t == t; }; // { dg-message "in requirements" }
// C++20 NB comment US115
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> concept Any = true;
// PR c++/67240
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-diagnostics-depth=2" }
template <class T, class U> concept Same = __is_same_as(T,U);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
// PR c++/91930
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T> struct basic_mixin {
basic_mixin() requires true;
// PR c++/82565
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct string
{
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept False = false;
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
template<typename T>
concept C1 = __is_same_as(T, int)
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct a {};
template <bool> using b = a;
// PR c++/92556
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Having this as a hard error is consistent with template argument deduction;
// it's an open core issue (jason 2020-02-14).
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S
{
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// FIXME: Diagnostics should be better.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <cassert>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T>
struct A {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
void f1(int);
void f2(int) noexcept;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> concept is_int = __is_same_as(T,int);
// PR c++/67138
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T>
concept Auto = true;
// PR c++/67152
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T>
concept HasType = requires { typename T::type; };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T, class U>
concept Same = __is_same_as(T, U);
// PR c++/94481
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Concept =
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C1 =
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
using TD = int;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Performance test... This should be fast.
// PR c++/65854
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Handle alias templates in type requirements.
// PR c++/66844
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U>
concept Same = __is_same_as(T, U);
// PR c++/66962
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename> struct remove_cv;
template <typename> struct is_reference;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T>
concept C1 =
// PR c++/67147
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class F, class I1, class I2 = I1>
concept IndirectCallableRelation = true;
// PR c++/67148
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
namespace std
// PR c++/67178
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept c = true;
// PR c++/67210
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U>
concept C = true;
// PR c++/67217
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T>
requires __is_same_as(T, double)
// PR c++/67225
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <class T, class U>
// PR c++/67225
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename Target>
// PR c++/67225
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <class>
// PR c++/67225
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <class, class>
// PR c++/67225
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename A, typename T>
// PR c++/67319
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <typename T>
// PR c++/67427
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <class S, class I>
// PR c++/67427
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <bool... Values> struct and_c_impl {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<class T> concept bool C1() { return false; }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<class T>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T>
bool f(T x) {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<class X>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<class X> concept bool C() {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
#include <type_traits>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
struct A {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
#include <type_traits>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
typedef int size_t;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <class, class>
class NumericArray {};
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename t>
struct S
{
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template <class T>
concept bool True = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename F>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class>
concept C1 = true;
// PR c++/68683
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename, typename>
struct is_same {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
namespace zero
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename T>
// PR c++/71368
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U> concept Same = __is_same_as(T,U);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class From, class To>
concept convertible_to = requires(From (&f)(), void (&g)(To)) { g(f()); };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T>
concept Destructible = false;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
#include <type_traits>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename T, T N>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename T, typename T::type>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename F>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<class I>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<class T>
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
template<class, class> constexpr bool is_same_v = false;
template<class T> constexpr bool is_same_v<T, T> = true;
// PR c++/84551
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-g -O" }
template<typename> concept C = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class> constexpr bool is_int = false;
template<> constexpr bool is_int<int> = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
namespace X
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
#include <type_traits>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename X, typename Y = X>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U>
concept Concept2 = requires (T t, U u)
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename I>
struct iterator_traits
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<int N, typename T>
concept Foo = requires(T t) { foo<N + 1>(t); }; // { dg-error "template instantiation depth" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Fooable = requires(T t) { foo(t); }; // { dg-error "template instantiation depth" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Fooable = requires(T t) { foo(t); };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Class = __is_class(T);
// PR c++/66988
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<bool B>
struct bool_constant {
// PR c++/67018
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T>
constexpr bool Val = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class> struct all_same {
static constexpr bool value = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> concept C = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept A = sizeof(T) >= 4;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct string;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// A poor mans Integral concept.
template<typename T>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Type = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept integer = __is_same_as(T, int);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept check_c = false;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test the types of atomic constraints
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename ...>
constexpr bool r () { return true; }
// PR c++/94480
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T, typename U>
constexpr bool is_same_v = __is_same (T, U);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test basic expression requirements
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test associated type requirements
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts -fconcepts-diagnostics-depth=2" }
// Test conversion requirements (not in C++20)
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test deduction requirements.
// PR c++/66758
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U>
concept C = requires (T t, U u) { t + u; };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U>
concept C = requires (T t, U u) { t + u; }; // { dg-message "in requirements" }
// PR c++/66832
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U, unsigned N>
requires requires (T& t, U &u) { t.foo(); u.foo(); }
// PR c++/92268
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> concept Two = true;
template <class T> concept One = Two<typename T::type>;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Int = __is_same_as(T, int);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class>
concept Dummy = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Int = __is_same_as(T, int);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Int = __is_same_as(T, int);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename... Ts> struct are_same;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept C = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Nothrow_assignable = __has_nothrow_assign(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
// This tests the terse notation.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
// Basic tests using function concepts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
// Basic tests using variable concepts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
// Basic tests for introduction syntax.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
struct Base {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts-ts" }
template<typename T, int N, typename... Xs> concept bool C1 = true;
// PR c++/79591
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class> concept True = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Change in grammar for the expression trailing `requires`.
template<typename T>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept Class = __is_class(T);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
concept True = true;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U> concept same_as = __is_same_as(T,U);
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> struct A { static const int x = 42; };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T, typename U>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace a
{
// PR c++/67348
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <type_traits>
#include <vector>
// PR c++/93257
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <bool, typename>
consteval void test() {}
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S
{
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S
{
// PR c++/92414
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A { virtual void foo (); };
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Downcast.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Virtual base.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
// dynamic_cast in a constructor.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// dynamic_cast in a destructor.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Adopted from g++.old-deja/g++.other/dyncast1.C.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Adopted from g++.old-deja/g++.other/dyncast1.C.
// But use reference dynamic_cast.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test HINT = -3 (SRC is a multiple public non-virtual base of DST).
struct A { virtual void a() {} };
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Here the hint turns out to be wrong: A is a public base of B2, but the
// dynamic_cast operand is not that subobject, but rather a sibling base of
// B2.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
// dynamic_cast in a constructor.
// PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Here 'b' doesn't point/refer to a public base of Derived.
struct Base {
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Downcast, with hint > 0.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Sidecast.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
// From clang's constant-expression-cxx2a.cpp.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Multiple levels.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Private base.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Protected base.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Unrelated type.
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Ambiguous base.
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test basic use.
struct S {
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// In c++2a we don't emit a call to _ZN3FooI3ArgEC1Ev.
struct Arg;
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
int i;
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
int uninit;
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct E { };
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct E {
constexpr E() = default;
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct E {
constexpr E() = default;
// PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct empty { };
// PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct empty { };
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A
{
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A
{
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// This bullet in [dcl.constexpr] is now gone:
// - every non-static data member and base class sub-object shall be initialized
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S { int i; };
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
/* We used to get the "constexpr constructor for union S::<unnamed union>
must initialize exactly one non-static data member" error, but not anymore
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
int a = 1;
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
constexpr S(int) {}
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
constexpr S(int) {}
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S { constexpr S () : s (5) {} constexpr S (int x) : s (x) {} int s; };
// PR c++/91369
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S {
// PR c++/93633
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct A {
// PR c++/93633
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct A {
// PR c++/93633
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
constexpr A () : a (0) {}
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
template <int N>
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
constexpr int *
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std
{
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std
{
// P0784R7
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std
{
// PR c++/91369
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct A {
// PR c++/91369
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct S {
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test non-polymorphic type.
#include <typeinfo>
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test polymorphic type.
#include <typeinfo>
// PR c++/88337 - Implement P1327R1: Allow dynamic_cast/typeid in constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test typeid in a template.
#include <typeinfo>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
union U
{
// PR c++/92695
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
virtual int get () = 0;
// PR c++/92695
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A { virtual int get() = 0; };
struct B : A { constexpr int get() override { return 10; } };
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test basic usage of 'constinit'.
const char *g() { return "dynamic init"; }
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// From PR83428.
struct S1
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
int foo ();
constexpr int constfoo () { return 42; }
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
S(int) { }
// PR c++/92134 - constinit malfunction in static data member.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct Value {
Value() : v{new int{42}} {}
// PR c++/92058 - constinit malfunction in static data member.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct B {
B() {}
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
constinit constinit int v1; // { dg-error "duplicate .constinit." }
constexpr constinit int v2 = 1; // { dg-error "can use at most one of the .constinit. and .constexpr. specifiers" }
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S { };
constinit extern S s;
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Check that we preserve DECL_DECLARED_CONSTINIT_P in duplicate_decls.
int gl = 42;
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Variable templates.
int nonconst;
// PR c++/91360 - Implement C++20 P1143R2: constinit
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
// A run-time test.
constexpr int foo (int x) { return x; }
baz ()
{
foo ({.d = 5, 6, .b = 2, 3}); // { dg-error "designator order for field 'S::b' does not match declaration order in 'S'" }
- // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++2a } .-1 }
+ // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++20 } .-1 }
bar ({.b = 1, .a = 2}); // { dg-error "designator order for field 'T::a' does not match declaration order in 'T'" }
}
S a = { 1, 2, 3 };
S b = { .a = 1, .b = 2, .c = 3 };
-S c = { 1, .b = 2, .c = 3 }; // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++2a } }
-S d = { .a = 1, 2, 3 }; // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++2a } }
+S c = { 1, .b = 2, .c = 3 }; // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++20 } }
+S d = { .a = 1, 2, 3 }; // { dg-error "either all initializer clauses should be designated or none of them should be" "" { target c++20 } }
S e = { .b = 1, .b = 2 }; // { dg-error "designator used multiple times in the same initializer list" }
#if __cplusplus > 201103L
void
foo ()
{
- S f = { .a = N... }; // { dg-error "'...' not allowed in designated initializer list" "" { target c++2a } }
+ S f = { .a = N... }; // { dg-error "'...' not allowed in designated initializer list" "" { target c++20 } }
}
#endif
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <new>
// PR c++/88969
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <new>
// PR c++/88969
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <new>
// PR c++/90171
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <new>
// PR c++/89420
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename>
struct S {
// PR c++/89836
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct W {
constexpr explicit operator bool() { return true; };
// P1668R1: Permit unevaluated inline asm in constexpr functions
// PR c++/91346
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
constexpr int
foo (bool b)
// P1668R1: Permit unevaluated inline asm in constexpr functions
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-Wno-pedantic" }
constexpr int
// PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wtautological-compare" }
namespace std {
// PR c++/94546
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> T&& forward(T&& t) { return static_cast<T&&>(t); }
// { dg-options "-std=c++2a" }
int j = []<class T>(T t, int i) { return i; }(3, 4);
-// { dg-bogus "lambda templates are only available with" "" { target c++2a } .-1 }
+// { dg-bogus "lambda templates are only available with" "" { target c++20 } .-1 }
// PR c++/94507 - ICE-on-invalid with lambda template.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S { };
// Test lambda mangling
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-require-weak "" }
// { dg-options "-fno-inline" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
void bar();
void bar(int);
// PR c++/89686
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename... Ts>
void foo(Ts... xs)
// P2095R0
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "" }
template <class... T>
// PR c++/94483
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<int... a> constexpr auto x1
= [...z = -a] (auto F) { return F(z...); };
int x;
void foo (int n) {
auto a1 = [=] { x = n; }; // { dg-bogus "implicit capture" "" { target c++17_down } }
- // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++2a } .-1 }
- // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++2a } .-2 }
+ // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++20 } .-1 }
+ // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++20 } .-2 }
auto a2 = [=, this] { x = n; };
// { dg-warning "explicit by-copy capture" "" { target c++17_down } .-1 }
auto a3 = [=, *this]() mutable { x = n; };
auto a6 = [&, *this]() mutable { x = n; };
auto a7 = [=] { // { dg-bogus "implicit capture" "" { target c++17_down } }
- // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++2a } .-1 }
- // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++2a } .-2 }
+ // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++20 } .-1 }
+ // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++20 } .-2 }
auto a = [=] { // { dg-bogus "implicit capture" "" { target c++17_down } }
- // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++2a } .-1 }
- // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++2a } .-2 }
+ // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++20 } .-1 }
+ // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++20 } .-2 }
auto a2 = [=] { x = n; }; // { dg-bogus "implicit capture" "" { target c++17_down } }
- // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++2a } .-1 }
- // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++2a } .-2 }
+ // { dg-warning "implicit capture of 'this' via '\\\[=\\\]' is deprecated" "" { target c++20 } .-1 }
+ // { dg-message "add explicit 'this' or '\\\*this' capture" "" { target c++20 } .-2 }
};
};
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
typedef decltype([]{}) C; // the closure type has no name for linkage purposes
// PR c++/92010
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T> void spam(decltype([]{}) (*s)[sizeof(T)] = nullptr)
{ }
// PR c++/94521
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T>
void spam(decltype([]{}) *s)
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// ill-formed, no diagnostic required: the two expressions are
// functionally equivalent but not equivalent
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <int N> void foo(const char (*s)[([]{}, N)]) {}
template <class T> void spam(decltype([]{}) (*s)[sizeof(T)]) {}
-// { dg-do link { target c++2a } }
+// { dg-do link { target c++20 } }
template <class T> T f(T t) { return t; }
using L = decltype([]{ return f(42); });
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
using L = decltype([]{ });
void f(L) { }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
static decltype([] { }) f();
static decltype([] { }) f(); // { dg-error "ambiguating" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <int N>
struct A { };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <auto N>
struct A {
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
// { dg-additional-sources "lambda-uneval9.cc" }
#include "lambda-uneval9.h"
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <new>
void operator delete(B *, std::destroying_delete_t) = delete;
};
void delete_B(B *b) { delete b; } // { dg-bogus "deleted .* deleted" }
- // { dg-error "deleted" "" { target c++2a } .-1 }
+ // { dg-error "deleted" "" { target c++20 } .-1 }
}
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <new>
void operator delete(void*) = delete;
};
void delete_B(B *b) { delete b; } // { dg-bogus "deleted .* deleted" }
- // { dg-error "deleted" "" { target c++2a } .-1 }
+ // { dg-error "deleted" "" { target c++20 } .-1 }
}
// P1094R2
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
inline namespace A::B { // { dg-error "a nested namespace definition cannot be inline" }
int i;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
[[no_unique_address]] struct B { }; // { dg-warning "attribute" }
[[no_unique_address]] int i; // { dg-warning "attribute" }
/* nodiscard attribute tests */
-/* { dg-do compile { target c++2a } } */
+/* { dg-do compile { target c++20 } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */
struct A { [[nodiscard("bad constructor")]] A() {} };
/* nodiscard attribute tests */
-/* { dg-do compile { target c++2a } } */
+/* { dg-do compile { target c++20 } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */
[[nodiscard, nodiscard]] int check1 (void); /* { dg-error "nodiscard\[^\n\r]*can appear at most once" } */
/* nodiscard attribute tests */
-/* { dg-do compile { target c++2a } } */
+/* { dg-do compile { target c++20 } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */
[[nodiscard(123)]] int check1 (void); /* { dg-error "nodiscard\[^\n\r]*must be a string constant" } */
/* nodiscard attribute tests */
-/* { dg-do compile { target c++2a } } */
+/* { dg-do compile { target c++20 } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */
[[nodiscard("not", "allowed")]] int check1 (void); /* { dg-error "wrong number of arguments.\[^\n\r]*nodiscard" } */
/* nodiscard attribute tests, adapted from gcc.dg/attr-warn-unused-result.c. */
-/* { dg-do compile { target c++2a } } */
+/* { dg-do compile { target c++20 } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */
#define NODIS [[nodiscard("exact_message")]]
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-additional-options "-fdelete-null-pointer-checks" }
struct A
// PR c++/88196
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct C { C *c; };
template <C> struct D;
// PR c++/88538
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
unsigned a;
// PR c++/88744
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#define SA(X) static_assert((X),#X)
// PR c++/77304
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {};
// PR c++/89532
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct tuple;
// PR c++/89833
// Test to verify that the same specializations on non-type template
// parameters of class types are in fact treated as the same.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A1 { char c[5]; };
// Test to verify that arrays of null pointer to members used as
// non-type template arguments are interprested as null regardless
// of the form of their initialization.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-O2 -Wall -fdump-tree-optimized" }
struct A { int i; };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<auto>
struct S { };
// PR c++/90101
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename List>
struct A;
// PR c++/90099
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct Unit {
int value;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int i;
// PR c++/90098
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int value;
// PR c++/90101
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<int N>
struct A{};
// PR c++/90100
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
inline constexpr bool is_nontype_list = false;
// parameters of class types are in fact treated as the same. Unlike
// nontype-class15.C which involves only one-dimensional arrays this
// test involves arrays of arrays and arrays of structs.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct AA3
{
// PR c++/92150
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct X {
int value;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct base { int i{}; };
struct derived : private base {};
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct p { unsigned p_ {}; };
// PR c++/92965
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<int>
class TS {
// PR c++/92948 - Fix class NTTP with template arguments.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
constexpr A(int) { }
// PR c++/92948 - Fix class NTTP with template arguments.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
struct A {
int i;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int i;
// PR c++/91754 - Fix template arguments comparison with class NTTP.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {};
// PR c++/88092
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
struct S {
// PR c++/88819
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T, template<T> class TT, class R = TT <0>> struct A
{
// PR c++/90938 - Initializing array with {1} works, but not {0}
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wall" }
struct A { int i; };
// PR c++/94592 - ICE with { } as template argument.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
constexpr A() {}
// PR c++/94592 - ICE with { } as template argument.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int i;
/* PR c++/94510 - nullptr_t implicitly cast to zero twice in std::array
- { dg-do compile { target c++2a } }
+ { dg-do compile { target c++20 } }
{ dg-options "-Wall" } */
struct A { int i; int f (); };
/* PR c++/94510 - nullptr_t implicitly cast to zero twice in std::array
- { dg-do compile { target c++2a } }
+ { dg-do compile { target c++20 } }
{ dg-options "-Wall" } */
struct A { char a[4]; };
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T>
struct A {
// Example from P0732
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T, T p> class X {
/* ... */
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
char ar[10];
// Example from P0732.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
using size_t = decltype(sizeof(1));
// If the entity is a template parameter object for a template parameter of
// type T, the type of the expression is const T.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U> struct same;
template <class T> struct same<T,T> {};
// PR c++/88216
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <class T, class U> struct same;
template <class T> struct same<T,T> {};
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
struct A {
int i;
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test from [dcl.init].
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test ill-formed code.
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A;
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct X { int a, b; };
struct Y { X x; };
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int i;
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S { int a[2]; };
struct A { S s[1]; };
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A { int a, b, c; };
struct S { A a; };
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int i[2];
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
struct A {
int i = 0;
// PR c++/92878 - Parenthesized init of aggregates in new-expression.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test new TYPE(...).
int f ();
// PR c++/92947 - Paren init of aggregates in unevaluated context.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int a;
// PR c++/94155 - crash in gimplifier with paren init of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S { int i, j; };
// PR c++/93790 - wrong paren-init of aggregates interference.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
int i;
// PR c++/94149 - make __is_constructible work with paren-init of aggrs.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <type_traits>
// PR c++/94149 - make __is_constructible work with paren-init of aggrs.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct nonaggr {
nonaggr() {}
// PR c++/94885 - paren-init of aggregates accepts invalid code.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T, typename = decltype(T(0))> // { dg-error "could not convert" }
void foo();
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
class a {
int b{};
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
// Test T[]().
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
union U {
int a;
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test that we don't perform lifetime extension for () init.
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
int h;
struct i {
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Test that we don't accept designated inits in ( ).
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct B { };
struct A : B {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-g" }
typedef __SIZE_TYPE__ size_t;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-g" }
struct pair {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename...> using A = auto; // { dg-error "not allowed" }
// In pre-20, the error is "invalid use of auto"
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A
{
// PR c++/93650
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
using type = enum _Ord { less };
// PR c++/92560
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
struct D
{
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
template <class T>
struct D
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct D
{
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
bool operator==(const A&) const;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int operator==(const A&) const = default; // { dg-error "return .bool" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A {
int &r; // { dg-message "reference" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct A
{
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
union A
{
// PR c++/92966
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct S {
int operator==(const S&) const = default; // { dg-error "must return 'bool'" }
// PR c++/94462
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct strong_ordering { };
// Test that we suggest adding #include <compare>.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
auto x = 1<=>2; // { dg-error "" }
// { dg-message "<compare>" "" { target *-*-* } .-1 }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
template <class T, T x = (T() <=> T())> // { dg-error "31:0 <=> 0" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std
{
// PR c++/94478 - ICE with defaulted comparison operator.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct B {};
bool operator!=(const B&, const B&) = default; // { dg-error "equality comparison operator can only be defaulted in a class definition" }
// This should continue to work.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T>
struct A {
// Test that very different operators still cause ambiguity with reversed.
struct X { operator int(); };
-bool operator==(X, int); // #1 { dg-message "reversed" "" { target c++2a } }
+bool operator==(X, int); // #1 { dg-message "reversed" "" { target c++20 } }
struct Y { operator int(); };
-bool operator==(Y, int); // #2 { dg-message "reversed" "" { target c++2a } }
+bool operator==(Y, int); // #2 { dg-message "reversed" "" { target c++20 } }
X x; Y y;
-bool b1 = x == y; // { dg-error "ambiguous" "" { target c++2a } }
-bool b2 = y == x; // { dg-error "ambiguous" "" { target c++2a } }
+bool b1 = x == y; // { dg-error "ambiguous" "" { target c++20 } }
+bool b2 = y == x; // { dg-error "ambiguous" "" { target c++20 } }
struct iterator {
bool operator==(const const_iterator &ci) const {
return ci == *this; // { dg-error "deleted" "" { target c++17_down } }
- } // { dg-warning "reversed" "" { target c++2a } .-1 }
+ } // { dg-warning "reversed" "" { target c++20 } .-1 }
};
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-fext-numeric-literals" }
int main()
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// missing #include <compare>
template <class T, T x = (T() <=> T()) == 0>
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
// PR c++/92774
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
// PR c++/92496
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<auto V>
struct A {};
// Test with all operators explicitly defaulted.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test with all operators explicitly defaulted.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test with only spaceship defaulted.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test with only spaceship defaulted.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test with only spaceship defaulted.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test for reversed candidates.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test for reversed candidates.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test with all operators explicitly defaulted.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// Test with all operators explicitly defaulted.
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
#include <compare>
// PR c++/94583
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std { struct strong_ordering { }; }
// PR c++/94583
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std { struct strong_ordering { }; }
// PR c++/94907
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std { struct strong_ordering { }; }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
// Test explicit weak_ordering.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
#include <compare>
struct A
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
inline namespace _8 { }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
auto x = __builtin_source_location (); // { dg-error "'source_location' is not a member of 'std'" }
// { dg-message "std::source_location' is defined in header '<source_location>'; did you forget to '#include <source_location>'" "" { target *-*-* } .-1 }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
void source_location ();
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
typedef int source_location;
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
struct source_location {
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// OK, return type of a function declaration at global scope.
template<class T> T::R f();
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace N {
// template<typename T> extern T::type v; // #1a
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
struct A
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct W {
template<typename T>
// P0634R3, PR c++/88358
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template <typename T>
int pi(T::your_pi);
// PR c++/88325
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename> struct A
{
// PR c++/88979
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
struct B {
// PR c++/90572
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct X { X(int); };
// DR 2413 - typename in conversion-function-ids.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T> struct S {
operator T::X();
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T> typename T::R f();
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T>
void f(int i)
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<class T>
struct A {
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct X {
template<typename T>
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// (5.2.1) simple-declaration or a function-definition in namespace scope
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// Not in namespace scope.
template<typename T>
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
template<typename T>
struct S {
// P0634R3
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-fconcepts" }
template <typename, typename> class A { class B; };
const char32_t *b = U"\U0001F914\u2753";
const char16_t *c = u"\uD802"; // { dg-error "is not a valid universal character" }
const char16_t *d = u"\U0000DFF0"; // { dg-error "is not a valid universal character" }
-const char16_t *e = u"\U00110000"; // { dg-error "is outside the UCS codespace" "" { target c++2a } }
+const char16_t *e = u"\U00110000"; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
// { dg-error "converting UCN to execution character set" "" { target *-*-* } .-1 }
const char32_t *f = U"\uD802"; // { dg-error "is not a valid universal character" }
const char32_t *g = U"\U0000DFF0"; // { dg-error "is not a valid universal character" }
-const char32_t *h = U"\U00110001"; // { dg-error "is outside the UCS codespace" "" { target c++2a } }
+const char32_t *h = U"\U00110001"; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
#if __cpp_unicode_characters >= 201411
const char8_t i = u8'\u00C0'; // { dg-error "character constant too long for its type" "" { target c++17 } }
#endif
const char16_t m = u'ab'; // { dg-error "character constant too long for its type" }
const char32_t n = U'ab'; // { dg-error "character constant too long for its type" }
#if __cpp_unicode_characters >= 201411
-const char8_t o = u8'\U00110002'; // { dg-error "is outside the UCS codespace" "" { target c++2a } }
+const char8_t o = u8'\U00110002'; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
// { dg-error "character constant too long for its type" "" { target c++17 } .-1 }
#endif
-const char16_t p = u'\U00110003'; // { dg-error "is outside the UCS codespace" "" { target c++2a } }
+const char16_t p = u'\U00110003'; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
// { dg-error "converting UCN to execution character set" "" { target *-*-* } .-1 }
-const char32_t q = U'\U00110004'; // { dg-error "is outside the UCS codespace" "" { target c++2a } }
+const char32_t q = U'\U00110004'; // { dg-error "is outside the UCS codespace" "" { target c++20 } }
// PR c++/88095
// Test class non-type template parameters for literal operator templates.
// Validate handling of failed class template argument deduction.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
using size_t = decltype(sizeof(int));
// PR c++/88095
// Test class non-type template parameters for literal operator templates.
// Validate rejection of class template parameter packs.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
using size_t = decltype(sizeof(int));
// PR c++/88095
// Test class non-type template parameters for literal operator templates.
// Validate support for class template argument deduction.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
namespace std {
using size_t = decltype(sizeof(int));
// PR c++/88095
// Test class non-type template parameters for literal operator templates.
// Validate that parameter packs are rejected.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct literal_class {
constexpr literal_class(...) { }
// PR c++/88095
// Test class non-type template parameters for literal operator templates.
// Validate that non-literal class types are rejected.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct non_literal_class {
constexpr non_literal_class(...) { }
// PR c++/88095
// Test class non-type template parameters for literal operator templates.
// Validate basic support.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
struct literal_class {
constexpr literal_class(...) { }
W& operator=(volatile W&) volatile;
};
-volatile int // { dg-warning ".volatile.-qualified return type is deprecated" "" { target c++2a } }
-fn (volatile int i) // { dg-warning ".volatile.-qualified parameter is deprecated" "" { target c++2a } }
+volatile int // { dg-warning ".volatile.-qualified return type is deprecated" "" { target c++20 } }
+fn (volatile int i) // { dg-warning ".volatile.-qualified parameter is deprecated" "" { target c++20 } }
{
volatile int v = 10;
int *volatile p = nullptr;
// Pre/post ++/--.
- v++; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
- ++v; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
- v--; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
- --v; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
- p++; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
- ++p; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
- p--; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
- --p; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++2a } }
+ v++; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
+ ++v; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
+ v--; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
+ --v; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
+ p++; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
+ ++p; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
+ p--; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
+ --p; // { dg-warning "expression of .volatile.-qualified type is deprecated" "" { target c++20 } }
return v + i + *p;
}
vi = 42;
vi = i;
vi = i = 42;
- i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
(vi = 42, 45);
- (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
i = vi; // LHS not volatile.
i = (vi = i, 42);
static_cast<void>(vi = i);
- static_cast<void>(i = vi = 42); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ static_cast<void>(i = vi = 42); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
(void)(vi = i);
- (void)(i = vi = 42); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ (void)(i = vi = 42); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
// Unevaluated operand.
decltype(vi = 42) x = vi;
decltype(i = vi = 42) x3 = i;
// Compound assignments.
- vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
i *= vi;
- decltype(vi -= 42) x2 = vi; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ decltype(vi -= 42) x2 = vi; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
// Structured bindings.
int a[] = { 10, 5 };
const auto & [cxr, cyr] = a;
- const volatile auto & [cvxr, cvyr] = a; // { dg-warning ".volatile.-qualified structured binding is deprecated" "" { target c++2a } }
- volatile auto & [vxr, vyr] = a; // { dg-warning ".volatile.-qualified structured binding is deprecated" "" { target c++2a } }
+ const volatile auto & [cvxr, cvyr] = a; // { dg-warning ".volatile.-qualified structured binding is deprecated" "" { target c++20 } }
+ volatile auto & [vxr, vyr] = a; // { dg-warning ".volatile.-qualified structured binding is deprecated" "" { target c++20 } }
}
void
fn3 ()
{
volatile int i, j, k = 0;
- i = j = k; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ i = j = k; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
ACCESS_ONCE(j);
volatile U u;
u.c = 42;
- i = u.c = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- u.c += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ i = u.c = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ u.c += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
volatile T t;
t.a = 3;
- j = t.a = 3; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- t.a += 3; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ j = t.a = 3; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ t.a += 3; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
volatile int *src = &i;
*src; // No assignment, don't warn.
{
volatile T t, u;
t = 42;
- u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
- t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++2a } }
+ u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
+ t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } }
}
void
// PR c++/91361 - P1152R4: Deprecating some uses of volatile.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wno-volatile" }
#define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x))
// PR c++/91361 - P1152R4: Deprecating some uses of volatile.
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
// { dg-options "-Wno-deprecated" }
#define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x))
+2020-05-13 Jason Merrill <jason@redhat.com>
+
+ * include/cpplib.h (enum c_lang): Change CXX2A to CXX20.
+ * init.c, lex.c: Adjust.
+
2020-05-12 Nathan Sidwell <nathan@acm.org>
EOF location is at end of file
If the hexadecimal value is larger than the upper bound of the UCS
codespace specified in ISO/IEC 10646, a pedantic warning is issued
- in all versions of C and in the C++2a or later versions of C++.
+ in all versions of C and in the C++20 or later versions of C++.
*PSTR must be preceded by "\u" or "\U"; it is assumed that the
buffer end is delimited by a non-hex digit. Returns false if the
CLK_STDC2X,
CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,
CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX17, CLK_CXX17,
- CLK_GNUCXX2A, CLK_CXX2A, CLK_ASM};
+ CLK_GNUCXX20, CLK_CXX20, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct GTY(()) cpp_string {
/* Nonzero for C2X decimal floating-point constants. */
unsigned char dfp_constants;
- /* Nonzero for C++2a __VA_OPT__ feature. */
+ /* Nonzero for C++20 __VA_OPT__ feature. */
unsigned char va_opt;
/* Nonzero for the '::' token. */
/* CXX14 */ { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0 },
/* GNUCXX17 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
/* CXX17 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 },
- /* GNUCXX2A */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
- /* CXX2A */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
+ /* GNUCXX20 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
+ /* CXX20 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0 },
/* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
if (CPP_OPTION (pfile, cplusplus))
{
- if (CPP_OPTION (pfile, lang) == CLK_CXX2A
- || CPP_OPTION (pfile, lang) == CLK_GNUCXX2A)
+ if (CPP_OPTION (pfile, lang) == CLK_CXX20
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX20)
_cpp_define_builtin (pfile, "__cplusplus 201709L");
else if (CPP_OPTION (pfile, lang) == CLK_CXX17
|| CPP_OPTION (pfile, lang) == CLK_GNUCXX17)
system headers. */
if (!cpp_in_system_header (pfile))
cpp_error (pfile, CPP_DL_PEDWARN,
- "__VA_OPT__ is not available until C++2a");
+ "__VA_OPT__ is not available until C++20");
}
else if (!pfile->state.va_args_ok)
{
variadic macro. */
cpp_error (pfile, CPP_DL_PEDWARN,
"__VA_OPT__ can only appear in the expansion"
- " of a C++2a variadic macro");
+ " of a C++20 variadic macro");
}
}
buffer->cur++, result->type = CPP_LESS_EQ;
if (*buffer->cur == '>'
&& CPP_OPTION (pfile, cplusplus)
- && CPP_OPTION (pfile, lang) >= CLK_GNUCXX2A)
+ && CPP_OPTION (pfile, lang) >= CLK_GNUCXX20)
buffer->cur++, result->type = CPP_SPACESHIP;
}
else if (*buffer->cur == '<')
if (argc < macro->paramc)
{
- /* In C++2a (here the va_opt flag is used), and also as a GNU
+ /* In C++20 (here the va_opt flag is used), and also as a GNU
extension, variadic arguments are allowed to not appear in
the invocation at all.
e.g. #define debug(format, args...) something