blob: 2865014f591f854072bde08c7114f1f1cb1f0372 [file] [log] [blame]
// PR c++/84874
// { dg-do run { target c++11 } }
// { dg-options "" }
struct A { int a, b; };
struct B { A d; };
void
foo (B *x)
{
*x = { .d = { .b = 5 } };
}
void
bar (A *x)
{
*x = { .b = 6 };
}
int
main ()
{
B b = { { 2, 3 } };
foo (&b);
if (b.d.a != 0 || b.d.b != 5)
__builtin_abort ();
b.d.a = 8;
bar (&b.d);
if (b.d.a != 0 || b.d.b != 6)
__builtin_abort ();
}