https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120777

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 61695
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61695&action=edit
gcc16-pr120777-wip.patch

Some further progress, the testcase now passes.
Except uncommenting the last two lines still results in errors.
I think there are 2 problems.
One is that at the end of the complete constructor for E we get something like
{.D.3067={._vptr.C=&_ZTV1E + 24, .c=47}, .D.3068={._vptr.D=&_ZTV1E + 72, .d=48,
.D.2967={.D.2757={._vptr.A=&_ZTV1E + 128}}}, .e=49,
.D.3073={.D.2757={._vptr.A=&_ZTV1B + 16, .a=45}, .b=46}}
The problem is the D.2967= initialization there, I bet we need it during the
construction, but maybe at the end of the complete ctor for a class with
virtual bases we should remove all initializers in the CONSTRUCTOR which are
beyond DECL_SIZE of the containing FIELD_DECL for bases.

And the other are the
abcu.C:183:13: error: ‘E{C{((& E::_ZTV1E) + 24), 45}, D{((& E::_ZTV1E) + 72),
45}, B{A{((& E::_ZTV1E) + 128), 43}, 42}}’ is not a constant expression
  183 | constexpr E a;
      |             ^
abcu.C:183:13: error: ‘((E*)(& a))->E::E()’ is not a constant expression
because it refers to an incompletely initialized variable
abcu.C:184:34: error: ‘E{C{((& E::_ZTV1E) + 24), 47}, D{((& E::_ZTV1E) + 72),
48}, 49, B{A{((& E::_ZTV1E) + 128), 45}, 46}}’ is not a constant expression
  184 | constexpr E b (45, 46, 47, 48, 49);
      |                                  ^
abcu.C:184:34: error: ‘((E*)(& b))->E::E(45, 46, 47, 48, 49)’ is not a constant
expression because it refers to an incompletely initialized variable
errors, perhaps on the other side we want to verify the bits beyond DECL_SIZE
of FIELD_DECLs aren't initialized rather than flagging them as incompletely
initialized.

Reply via email to