1 /* { dg-do compile } */
2 /* { dg-options "-std=gnu99 -Wpedantic" } */
3 /* { dg-prune-output ".*near initialization for.*" } */
5 typedef unsigned vec
__attribute__ ((vector_size (2 * sizeof (int))));
6 union u
{ int a
; double d
; };
7 struct S
{ int i
; char fam
[]; };
10 vec v
= { 1, 2, 3 }; /* { dg-warning "17:excess elements in vector initializer" } */
11 int a1
= { 1, 2 }; /* { dg-warning "15:excess elements in scalar initializer" } */
12 int a2
[2] = { 1, 2, 3 }; /* { dg-warning "21:excess elements in array initializer" } */
13 int a3
[] = { [1 ? 1 : i
] = 0 }; /* { dg-warning "15:array index in initializer is not an integer constant expression" } */
14 int a4
[] = { [1 ... 1 ? 2 : i
] = 0 }; /* { dg-warning "15:array index in initializer is not an integer constant expression" } */
15 /* { dg-warning "ISO C forbids" "ISO C" { target *-*-* } 14 } */
16 char a5
[] = ("lol"); /* { dg-warning "13:array initialized from parenthesized string constant" } */
17 char a6
[] = { ("foo") }; /* { dg-warning "13:array initialized from parenthesized string constant" } */
18 char *a7
= (char []) { ("bar") }; /* { dg-warning "12:array initialized from parenthesized string constant" } */
19 union u u
= { 1, 1.0 }; /* { dg-warning "18:excess elements in union initializer" } */
20 struct S s
= { 1, 2 }; /* { dg-warning "14:initialization of a flexible array member" } */