While talking about PR125336, I noticed that we were unnecessarily omitting
a subobject CONSTRUCTOR for non-potentially-overlapping fields of empty
class type. Let's check is_empty_field instead.
gcc/cp/ChangeLog:
* constexpr.cc (init_subob_ctx): Check is_empty_field.
{
/* This can happen if the enclosing object is also an empty subobject
(c++/125315). */
- gcc_checking_assert (is_empty_class (type));
+ gcc_checking_assert (is_empty_field (index));
return;
}
new_ctx.object = build_ctor_subob_ref (index, type, ctx->object);
}
- if (is_empty_class (type)
+ if (is_empty_field (index)
&& TREE_CODE (ctxtype) != UNION_TYPE)
/* Leave ctor null for an empty subobject of a non-union class, they aren't
represented in the result of evaluation. */