2017-09-26 Thomas Koenig <tkoenig@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / init-bad-9.c
blob035d34940dd600b926d5e19c8d97df6e34b4e764
1 /* PR c/71552 - Confusing error for incorrect struct initialization */
2 /* { dg-do compile } */
4 struct A { void *p; };
5 struct B { struct A *p; };
6 struct A a;
8 /* Verify that the initializer is diagnosed for its incompatibility
9 with the type of the object being initialized, not for its lack
10 of constness (which is a lesser problem). */
11 struct B b = { a }; /* { dg-error "incompatible types when initializing" } */
12 struct B *p = a; /* { dg-error "incompatible types when initializing" } */