blob: 43e26adaceab452e66779242c4d2fa2818f938d6 [file] [log] [blame]
// Test that initializing a non-POD base with a trivial copy ctor doesn't
// clobber tail padding.
// { dg-do run }
struct X { ~X() {} int n; char d; };
struct Y { Y(); char c[3]; };
struct Z : X, virtual Y { Z(); };
X f() { X nrvo; __builtin_memset(&nrvo, 0, sizeof(X)); return nrvo; }
Z::Z() : Y(), X(f()) {}
Y::Y() { c[0] = 1; }
int main() {
Z z;
if (z.c[0] != 1)
__builtin_abort ();
}