c++: constexpr empty aggr [PR105795]
authorJason Merrill <jason@redhat.com>
Wed, 1 Jun 2022 20:13:48 +0000 (16:13 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 2 Jun 2022 21:10:00 +0000 (17:10 -0400)
commit7a4b608b31af3824d615cd490f855e3730d217b4
tree80332a2b39c3c98c433b03303a8e06d1ec1510df
parentaf039edf70b26a0033a9f66338da2faebc6c5027
c++: constexpr empty aggr [PR105795]

In this testcase, leaving ctx->ctor pointing to the enclosing object meant
that evaluating the initializer for the subobject clobbered previous
initializers for the enclosing object.  So do update ctx->ctor, just don't
add it to the enclosing object ctor.

PR c++/105795

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_bare_aggregate): Always call
init_subob_ctx.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/constexpr-aggr-base1.C: New test.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1z/constexpr-aggr-base1.C [new file with mode: 0644]