2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / Woverride-init-side-effects-1.c
blob50f198d7fa0750c5450ed17238ca64068f91557e
1 /* PR c/64918 */
2 /* { dg-do compile } */
3 /* { dg-options "" } */
5 struct S { int m, n; };
6 union U { short s; long int l; };
8 void
9 foo (int i)
11 int a[] = {
12 [0] = ++i,
13 [1] = i,
14 [0] = 42 /* { dg-warning "initialized field with side-effects overwritten" } */
16 struct S s = {
17 .n = ++i,
18 .m = i,
19 .n = i /* { dg-warning "initialized field with side-effects overwritten" } */
21 union U u = {
22 .s = i--,
23 .l = 42 /* { dg-warning "initialized field with side-effects overwritten" } */