gcc/testsuite/gcc.dg/Wdesignated-init-2.c
raw| 1 | /* PR c/59855 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-std=gnu11" } */ |
| 4 | |
| 5 | struct S { |
| 6 | int a; |
| 7 | union { |
| 8 | int b; |
| 9 | int c; |
| 10 | }; |
| 11 | } __attribute__((designated_init)); |
| 12 | |
| 13 | struct S s1 = { .a = 0, .b = 0 }; |
| 14 | struct S s2 = { 0, 0 }; /* { dg-warning "(positional|near initialization)" } */ |
| 15 | struct S s3 = { .a = 5, 0 }; /* { dg-warning "(positional|near initialization)" } */ |