c++: constexpr empty subobject elision [PR110197]
Now that init_subob_ctx no longer sets new_ctx.ctor for a subobject of
empty type, it seems we need to ensure its callers also consistently
omit entries in the parent ctx->ctor for such subobjects. We also need
to allow cxx_eval_array_reference to synthesize an empty subobject even
if the array CONSTRUCTOR has CONSTRUCTOR_NO_CLEARING set.
PR c++/110197
gcc/cp/ChangeLog:
* constexpr.cc (cxx_eval_array_reference): Allow synthesizing an
empty subobject even if CONSTRUCTOR_NO_CLEARING is set.
(cxx_eval_bare_aggregate): Set 'no_slot' to true more generally
whenever new_ctx.ctor is set to NULL_TREE by init_subob_ctx,
i.e. whenever initializing an subobject of empty type.
(cxx_eval_vec_init_1): Define 'no_slot' as above and use it
accordingly.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-empty18.C: New test.
* g++.dg/cpp0x/constexpr-empty19.C: New test.