static void
process_subob_fn (tree fn, tree *spec_p, bool *trivial_p,
bool *deleted_p, bool *constexpr_p,
- bool diag, tree arg)
+ bool diag, tree arg, bool dtor_from_ctor = false)
{
if (!fn || fn == error_mark_node)
goto bad;
*spec_p = merge_exception_specifiers (*spec_p, raises);
}
- if (!trivial_fn_p (fn))
+ if (!trivial_fn_p (fn) && !dtor_from_ctor)
{
if (trivial_p)
*trivial_p = false;
}
/* Subroutine of synthesized_method_walk to allow recursion into anonymous
- aggregates. */
+ aggregates. If DTOR_FROM_CTOR is true, we're walking subobject destructors
+ called from a synthesized constructor, in which case we don't consider
+ the triviality of the subobject destructor. */
static void
walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
int quals, bool copy_arg_p, bool move_p,
bool assign_p, tree *spec_p, bool *trivial_p,
bool *deleted_p, bool *constexpr_p,
- bool diag, int flags, tsubst_flags_t complain)
+ bool diag, int flags, tsubst_flags_t complain,
+ bool dtor_from_ctor)
{
tree field;
for (field = fields; field; field = DECL_CHAIN (field))
walk_field_subobs (TYPE_FIELDS (mem_type), fnname, sfk, quals,
copy_arg_p, move_p, assign_p, spec_p, trivial_p,
deleted_p, constexpr_p,
- diag, flags, complain);
+ diag, flags, complain, dtor_from_ctor);
continue;
}
rval = locate_fn_flags (mem_type, fnname, argtype, flags, complain);
process_subob_fn (rval, spec_p, trivial_p, deleted_p,
- constexpr_p, diag, field);
+ constexpr_p, diag, field, dtor_from_ctor);
}
}
dtors would be a double-fault). */
process_subob_fn (rval, NULL, NULL,
deleted_p, NULL, false,
- basetype);
+ basetype, /*dtor_from_ctor*/true);
}
if (check_vdtor && type_has_virtual_destructor (basetype))
NULL_TREE, flags, complain);
process_subob_fn (rval, NULL, NULL,
deleted_p, NULL, false,
- basetype);
+ basetype, /*dtor_from_ctor*/true);
}
}
}
walk_field_subobs (TYPE_FIELDS (ctype), fnname, sfk, quals,
copy_arg_p, move_p, assign_p, spec_p, trivial_p,
deleted_p, constexpr_p,
- diag, flags, complain);
+ diag, flags, complain, /*dtor_from_ctor*/false);
if (ctor_p)
walk_field_subobs (TYPE_FIELDS (ctype), complete_dtor_identifier,
sfk_destructor, TYPE_UNQUALIFIED, false,
false, false, NULL, NULL,
deleted_p, NULL,
- false, flags, complain);
+ false, flags, complain, /*dtor_from_ctor*/true);
pop_scope (scope);