[Bug c++/68903] missing default initialization of member when combined with virtual inheritance

spam at trzeci dot pl gcc-bugzilla@gcc.gnu.org
Thu Mar 12 13:03:53 GMT 2020


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

--- Comment #2 from trzeci <spam at trzeci dot pl> ---
Simpler test:

struct A
{
  int a = 3;
};

struct B : public A
{};

struct C : public virtual B
{
  int c = a;
};

#include <iostream>

int main()
{
  C c;
  std::cout << c.a << " " << c.c << std::endl;
  return 0;
}

outputs: 3 0
instead of: 3 3

tested on 8.4.0


More information about the Gcc-bugs mailing list