summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr36489.c
blob: 5cf221615ec33c46963684731c747ac5b6d33814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* PR c/36489 */
/* { dg-do compile } */
/* { dg-options "-Woverride-init" } */

struct A { int a; int b[3]; };
union B { int a; int b[3]; };
int t1[10][10]
  = { [1][2] = 11, [1][3] = 12 };
int t2[10][10]
  = { [1][2] = 11, [1] = { [3] = 12 } };	/* { dg-warning "initializ" } */
int t3[10][10]
  = { [1][2] = 11, [1][2] = 12 };		/* { dg-warning "initializ" } */
struct A t4[2]
  = { [0].b[0] = 1, [0].b[1] = 2, [0].b[2] = 3 };
struct A t5[2]
  = { [0].b[0] = 1, [0].b[1] = 2, [0].b = { 3 } }; /* { dg-warning "initializ" } */
union B t6
  = { .b[0] = 1, .b[1] = 2, .b[2] = 3 };
union B t7
  = { .b[0] = 1, .b[1] = 2, .b = { 2 } };	/* { dg-warning "initializ" } */
union B t8
  = { .b[0] = 1, .b[1] = 2, .b[1] = 3 };	/* { dg-warning "initializ" } */