]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/init-bad-9.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / init-bad-9.c
1 /* PR c/71552 - Confusing error for incorrect struct initialization */
2 /* { dg-do compile } */
3
4 struct A { void *p; };
5 struct B { struct A *p; };
6 struct A a;
7
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" } */