https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98423
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think it isn't solely about the process_subob_fn
if (TREE_CODE (arg) == FIELD_DECL
&& TREE_CODE (DECL_CONTEXT (arg)) == UNION_TYPE)
{
if (deleted_p)
*deleted_p = true;
if (diag)
error ("union member %q+D with non-trivial %qD", arg, fn);
}
diagnostics that probably shouldn't be performed if the union type has nsdmi on
any member, isn't it also the:
if (constexpr_p && !DECL_DECLARED_CONSTEXPR_P (fn))
{
*constexpr_p = false;
if (diag)
{
inform (DECL_SOURCE_LOCATION (fn),
SFK_DTOR_P (sfk)
? G_("defaulted destructor calls non-%<constexpr%> %qD")
: G_("defaulted constructor calls non-%<constexpr%> %qD"),
fn);
explain_invalid_constexpr_fn (fn);
}
}
diagnostics (why would a default constructor of a union be non-constexpr just
because some variant member without nsdmi has non-constexpr default
constructor), perhaps the spec_p stuff too.
So for UNION_TYPE we probably want to search for nsdmis in another loop at the
start of walk_field_subobs and punt some tests for some special members if
there are any nsdmis.