2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr36489.c
blob5cf221615ec33c46963684731c747ac5b6d33814
1 /* PR c/36489 */
2 /* { dg-do compile } */
3 /* { dg-options "-Woverride-init" } */
5 struct A { int a; int b[3]; };
6 union B { int a; int b[3]; };
7 int t1[10][10]
8 = { [1][2] = 11, [1][3] = 12 };
9 int t2[10][10]
10 = { [1][2] = 11, [1] = { [3] = 12 } }; /* { dg-warning "initializ" } */
11 int t3[10][10]
12 = { [1][2] = 11, [1][2] = 12 }; /* { dg-warning "initializ" } */
13 struct A t4[2]
14 = { [0].b[0] = 1, [0].b[1] = 2, [0].b[2] = 3 };
15 struct A t5[2]
16 = { [0].b[0] = 1, [0].b[1] = 2, [0].b = { 3 } }; /* { dg-warning "initializ" } */
17 union B t6
18 = { .b[0] = 1, .b[1] = 2, .b[2] = 3 };
19 union B t7
20 = { .b[0] = 1, .b[1] = 2, .b = { 2 } }; /* { dg-warning "initializ" } */
21 union B t8
22 = { .b[0] = 1, .b[1] = 2, .b[1] = 3 }; /* { dg-warning "initializ" } */