Index: external/gpl3/gcc/dist/gcc/cp/call.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/call.c,v retrieving revision 1.1.1.18 diff -p -u -r1.1.1.18 call.c --- external/gpl3/gcc/dist/gcc/cp/call.c 22 Jul 2022 19:53:08 -0000 1.1.1.18 +++ external/gpl3/gcc/dist/gcc/cp/call.c 23 Nov 2023 21:59:45 -0000 @@ -932,7 +932,7 @@ field_in_pset (hash_set &pse for (field = TYPE_FIELDS (TREE_TYPE (field)); field; field = DECL_CHAIN (field)) { - field = next_initializable_field (field); + field = next_aggregate_field (field); if (field == NULL_TREE) break; if (field_in_pset (pset, field)) @@ -949,7 +949,7 @@ build_aggr_conv (tree type, tree ctor, i { unsigned HOST_WIDE_INT i = 0; conversion *c; - tree field = next_initializable_field (TYPE_FIELDS (type)); + tree field = next_aggregate_field (TYPE_FIELDS (type)); tree empty_ctor = NULL_TREE; hash_set pset; @@ -996,7 +996,7 @@ build_aggr_conv (tree type, tree ctor, i } } - for (; field; field = next_initializable_field (DECL_CHAIN (field))) + for (; field; field = next_aggregate_field (DECL_CHAIN (field))) { tree ftype = TREE_TYPE (field); tree val; @@ -7645,10 +7645,10 @@ convert_like_real_1 (conversion *convs, totype = complete_type_or_maybe_complain (totype, NULL_TREE, complain); if (!totype) return error_mark_node; - tree field = next_initializable_field (TYPE_FIELDS (totype)); + tree field = next_aggregate_field (TYPE_FIELDS (totype)); vec *vec = NULL; CONSTRUCTOR_APPEND_ELT (vec, field, array); - field = next_initializable_field (DECL_CHAIN (field)); + field = next_aggregate_field (DECL_CHAIN (field)); CONSTRUCTOR_APPEND_ELT (vec, field, size_int (len)); tree new_ctor = build_constructor (totype, vec); return get_target_expr_sfinae (new_ctor, complain); @@ -12512,8 +12512,8 @@ type_has_extended_temps (tree type) { if (is_std_init_list (type)) return true; - for (tree f = next_initializable_field (TYPE_FIELDS (type)); - f; f = next_initializable_field (DECL_CHAIN (f))) + for (tree f = next_aggregate_field (TYPE_FIELDS (type)); + f; f = next_aggregate_field (DECL_CHAIN (f))) if (type_has_extended_temps (TREE_TYPE (f))) return true; } Index: external/gpl3/gcc/dist/gcc/cp/class.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/class.c,v retrieving revision 1.1.1.16 diff -p -u -r1.1.1.16 class.c --- external/gpl3/gcc/dist/gcc/cp/class.c 22 Jul 2022 19:53:08 -0000 1.1.1.16 +++ external/gpl3/gcc/dist/gcc/cp/class.c 23 Nov 2023 21:59:46 -0000 @@ -7697,10 +7697,10 @@ finish_struct (tree t, tree attributes) bool ok = false; if (processing_template_decl) { - tree f = next_initializable_field (TYPE_FIELDS (t)); + tree f = next_aggregate_field (TYPE_FIELDS (t)); if (f && TYPE_PTR_P (TREE_TYPE (f))) { - f = next_initializable_field (DECL_CHAIN (f)); + f = next_aggregate_field (DECL_CHAIN (f)); if (f && same_type_p (TREE_TYPE (f), size_type_node)) ok = true; } Index: external/gpl3/gcc/dist/gcc/cp/constexpr.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/constexpr.c,v retrieving revision 1.1.1.13.2.1 diff -p -u -r1.1.1.13.2.1 constexpr.c --- external/gpl3/gcc/dist/gcc/cp/constexpr.c 13 Jul 2023 09:18:23 -0000 1.1.1.13.2.1 +++ external/gpl3/gcc/dist/gcc/cp/constexpr.c 23 Nov 2023 21:59:46 -0000 @@ -784,7 +784,7 @@ cx_check_missing_mem_inits (tree ctype, if (TREE_CODE (ctype) == UNION_TYPE) { - if (nelts == 0 && next_initializable_field (field)) + if (nelts == 0 && next_aggregate_field (field)) { if (complain) error ("% constructor for union %qT must " @@ -2763,7 +2763,7 @@ reduced_constant_expression_p (tree t) field = NULL_TREE; } else - field = next_initializable_field (TYPE_FIELDS (TREE_TYPE (t))); + field = next_subobject_field (TYPE_FIELDS (TREE_TYPE (t))); } else field = NULL_TREE; @@ -2775,15 +2775,15 @@ reduced_constant_expression_p (tree t) return false; /* Empty class field may or may not have an initializer. */ for (; field && idx != field; - field = next_initializable_field (DECL_CHAIN (field))) + field = next_subobject_field (DECL_CHAIN (field))) if (!is_really_empty_class (TREE_TYPE (field), /*ignore_vptr*/false)) return false; if (field) - field = next_initializable_field (DECL_CHAIN (field)); + field = next_subobject_field (DECL_CHAIN (field)); } /* There could be a non-empty field at the end. */ - for (; field; field = next_initializable_field (DECL_CHAIN (field))) + for (; field; field = next_subobject_field (DECL_CHAIN (field))) if (!is_really_empty_class (TREE_TYPE (field), /*ignore_vptr*/false)) return false; if (CONSTRUCTOR_NO_CLEARING (t)) Index: external/gpl3/gcc/dist/gcc/cp/cp-gimplify.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/cp-gimplify.c,v retrieving revision 1.1.1.14.2.1 diff -p -u -r1.1.1.14.2.1 cp-gimplify.c --- external/gpl3/gcc/dist/gcc/cp/cp-gimplify.c 13 Jul 2023 09:18:23 -0000 1.1.1.14.2.1 +++ external/gpl3/gcc/dist/gcc/cp/cp-gimplify.c 23 Nov 2023 21:59:46 -0000 @@ -3235,7 +3235,7 @@ get_source_location_impl_type (location_ int cnt = 0; for (tree field = TYPE_FIELDS (type); - (field = next_initializable_field (field)) != NULL_TREE; + (field = next_aggregate_field (field)) != NULL_TREE; field = DECL_CHAIN (field)) { if (DECL_NAME (field) != NULL_TREE) @@ -3395,7 +3395,7 @@ fold_builtin_source_location (location_t vec *v = NULL; vec_alloc (v, 4); for (tree field = TYPE_FIELDS (source_location_impl); - (field = next_initializable_field (field)) != NULL_TREE; + (field = next_aggregate_field (field)) != NULL_TREE; field = DECL_CHAIN (field)) { const char *n = IDENTIFIER_POINTER (DECL_NAME (field)); Index: external/gpl3/gcc/dist/gcc/cp/cp-tree.h =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/cp-tree.h,v retrieving revision 1.1.1.14.2.1 diff -p -u -r1.1.1.14.2.1 cp-tree.h --- external/gpl3/gcc/dist/gcc/cp/cp-tree.h 13 Jul 2023 09:18:23 -0000 1.1.1.14.2.1 +++ external/gpl3/gcc/dist/gcc/cp/cp-tree.h 23 Nov 2023 21:59:46 -0000 @@ -6617,7 +6617,8 @@ extern bool is_direct_enum_init (tree, extern void initialize_artificial_var (tree, vec *); extern tree check_var_type (tree, tree, location_t); extern tree reshape_init (tree, tree, tsubst_flags_t); -extern tree next_initializable_field (tree); +extern tree next_aggregate_field (tree); +extern tree next_subobject_field (tree); extern tree fndecl_declared_return_type (tree); extern bool undeduced_auto_decl (tree); extern bool require_deduced_type (tree, tsubst_flags_t = tf_warning_or_error); Index: external/gpl3/gcc/dist/gcc/cp/decl.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/decl.c,v retrieving revision 1.9.2.1 diff -p -u -r1.9.2.1 decl.c --- external/gpl3/gcc/dist/gcc/cp/decl.c 13 Jul 2023 09:18:23 -0000 1.9.2.1 +++ external/gpl3/gcc/dist/gcc/cp/decl.c 23 Nov 2023 21:59:46 -0000 @@ -6024,20 +6024,36 @@ static tree reshape_init_r (tree, reshap /* FIELD is a FIELD_DECL or NULL. In the former case, the value returned is the next FIELD_DECL (possibly FIELD itself) that can be - initialized. If there are no more such fields, the return value - will be NULL. */ + initialized as if for an aggregate class. If there are no more such fields, + the return value will be NULL. */ tree -next_initializable_field (tree field) +next_aggregate_field (tree field) { while (field && (TREE_CODE (field) != FIELD_DECL || DECL_UNNAMED_BIT_FIELD (field) || (DECL_ARTIFICIAL (field) - /* In C++17, don't skip base class fields. */ - && !(cxx_dialect >= cxx17 && DECL_FIELD_IS_BASE (field)) - /* Don't skip vptr fields. We might see them when we're - called from reduced_constant_expression_p. */ + /* In C++17, aggregates can have bases. */ + && !(cxx_dialect >= cxx17 && DECL_FIELD_IS_BASE (field))))) + field = DECL_CHAIN (field); + + return field; +} + +/* FIELD is an element of TYPE_FIELDS or NULL. In the former case, the value + returned is the next FIELD_DECL (possibly FIELD itself) that corresponds + to a subobject. If there are no more such fields, the return value will be + NULL. */ + +tree +next_subobject_field (tree field) +{ + while (field + && (TREE_CODE (field) != FIELD_DECL + || DECL_UNNAMED_BIT_FIELD (field) + || (DECL_ARTIFICIAL (field) + && !DECL_FIELD_IS_BASE (field) && !DECL_VIRTUAL_P (field)))) field = DECL_CHAIN (field); @@ -6199,7 +6215,7 @@ reshape_init_class (tree type, reshape_i /* The initializer for a class is always a CONSTRUCTOR. */ new_init = build_constructor (init_list_type_node, NULL); - field = next_initializable_field (TYPE_FIELDS (type)); + field = next_aggregate_field (TYPE_FIELDS (type)); if (!field) { @@ -6289,7 +6305,7 @@ reshape_init_class (tree type, reshape_i if (TREE_CODE (type) == UNION_TYPE) break; - field = next_initializable_field (DECL_CHAIN (field)); + field = next_aggregate_field (DECL_CHAIN (field)); } return new_init; Index: external/gpl3/gcc/dist/gcc/cp/init.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/init.c,v retrieving revision 1.1.1.15 diff -p -u -r1.1.1.15 init.c --- external/gpl3/gcc/dist/gcc/cp/init.c 22 Jul 2022 19:53:07 -0000 1.1.1.15 +++ external/gpl3/gcc/dist/gcc/cp/init.c 23 Nov 2023 21:59:46 -0000 @@ -422,7 +422,7 @@ build_value_init_noctor (tree type, tsub && !COMPLETE_TYPE_P (ftype) && !TYPE_DOMAIN (ftype) && COMPLETE_TYPE_P (TREE_TYPE (ftype)) - && (next_initializable_field (DECL_CHAIN (field)) + && (next_aggregate_field (DECL_CHAIN (field)) == NULL_TREE)) continue; Index: external/gpl3/gcc/dist/gcc/cp/lambda.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/lambda.c,v retrieving revision 1.1.1.11.2.1 diff -p -u -r1.1.1.11.2.1 lambda.c --- external/gpl3/gcc/dist/gcc/cp/lambda.c 13 Jul 2023 09:18:23 -0000 1.1.1.11.2.1 +++ external/gpl3/gcc/dist/gcc/cp/lambda.c 23 Nov 2023 21:59:46 -0000 @@ -427,9 +427,9 @@ build_capture_proxy (tree member, tree i if (DECL_VLA_CAPTURE_P (member)) { /* Rebuild the VLA type from the pointer and maxindex. */ - tree field = next_initializable_field (TYPE_FIELDS (type)); + tree field = next_aggregate_field (TYPE_FIELDS (type)); tree ptr = build_simple_component_ref (object, field); - field = next_initializable_field (DECL_CHAIN (field)); + field = next_aggregate_field (DECL_CHAIN (field)); tree max = build_simple_component_ref (object, field); type = build_cplus_array_type (TREE_TYPE (TREE_TYPE (ptr)), build_index_type (max)); Index: external/gpl3/gcc/dist/gcc/cp/method.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/method.c,v retrieving revision 1.1.1.14 diff -p -u -r1.1.1.14 method.c --- external/gpl3/gcc/dist/gcc/cp/method.c 22 Jul 2022 19:53:07 -0000 1.1.1.14 +++ external/gpl3/gcc/dist/gcc/cp/method.c 23 Nov 2023 21:59:46 -0000 @@ -1318,7 +1318,7 @@ build_comparison_op (tree fndecl, tsubst /* A defaulted comparison operator function for class C is defined as deleted if ... C has variant members. */ if (TREE_CODE (ctype) == UNION_TYPE - && next_initializable_field (TYPE_FIELDS (ctype))) + && next_aggregate_field (TYPE_FIELDS (ctype))) { if (complain & tf_error) inform (info.loc, "cannot default compare union %qT", ctype); @@ -1345,10 +1345,10 @@ build_comparison_op (tree fndecl, tsubst auto_vec comps; /* Compare each of the subobjects. Note that we get bases from - next_initializable_field because we're past C++17. */ - for (tree field = next_initializable_field (TYPE_FIELDS (ctype)); + next_aggregate_field because we're past C++17. */ + for (tree field = next_aggregate_field (TYPE_FIELDS (ctype)); field; - field = next_initializable_field (DECL_CHAIN (field))) + field = next_aggregate_field (DECL_CHAIN (field))) { tree expr_type = TREE_TYPE (field); @@ -1364,7 +1364,7 @@ build_comparison_op (tree fndecl, tsubst continue; } else if (ANON_UNION_TYPE_P (expr_type) - && next_initializable_field (TYPE_FIELDS (expr_type))) + && next_aggregate_field (TYPE_FIELDS (expr_type))) { if (complain & tf_error) inform (DECL_SOURCE_LOCATION (field), "cannot default compare " Index: external/gpl3/gcc/dist/gcc/cp/pt.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/pt.c,v retrieving revision 1.1.1.18.2.1 diff -p -u -r1.1.1.18.2.1 pt.c --- external/gpl3/gcc/dist/gcc/cp/pt.c 13 Jul 2023 09:18:24 -0000 1.1.1.18.2.1 +++ external/gpl3/gcc/dist/gcc/cp/pt.c 23 Nov 2023 21:59:47 -0000 @@ -28703,7 +28703,7 @@ maybe_aggr_guide (tree tmpl, tree init, len; --len, field = DECL_CHAIN (field)) { - field = next_initializable_field (field); + field = next_aggregate_field (field); if (!field) return NULL_TREE; tree ftype = finish_decltype_type (field, true, complain); Index: external/gpl3/gcc/dist/gcc/cp/tree.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/tree.c,v retrieving revision 1.1.1.17.2.1 diff -p -u -r1.1.1.17.2.1 tree.c --- external/gpl3/gcc/dist/gcc/cp/tree.c 13 Jul 2023 09:18:24 -0000 1.1.1.17.2.1 +++ external/gpl3/gcc/dist/gcc/cp/tree.c 23 Nov 2023 21:59:47 -0000 @@ -4591,8 +4591,8 @@ structural_type_p (tree t, bool explain) inform (location_of (t), "%qT has a mutable member", t); return false; } - for (tree m = next_initializable_field (TYPE_FIELDS (t)); m; - m = next_initializable_field (DECL_CHAIN (m))) + for (tree m = next_aggregate_field (TYPE_FIELDS (t)); m; + m = next_aggregate_field (DECL_CHAIN (m))) { if (TREE_PRIVATE (m) || TREE_PROTECTED (m)) { Index: external/gpl3/gcc/dist/gcc/cp/typeck2.c =================================================================== RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/cp/Attic/typeck2.c,v retrieving revision 1.1.1.15 diff -p -u -r1.1.1.15 typeck2.c --- external/gpl3/gcc/dist/gcc/cp/typeck2.c 22 Jul 2022 19:53:08 -0000 1.1.1.15 +++ external/gpl3/gcc/dist/gcc/cp/typeck2.c 23 Nov 2023 21:59:47 -0000 @@ -1330,7 +1330,7 @@ digest_init_r (tree type, tree init, int the first element of d, which is the B base subobject. The base of type B is copy-initialized from the D temporary, causing object slicing. */ - tree field = next_initializable_field (TYPE_FIELDS (type)); + tree field = next_aggregate_field (TYPE_FIELDS (type)); if (field && DECL_FIELD_IS_BASE (field)) { if (warning_at (loc, 0, "initializing a base class of type %qT "