OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / init-desig-obs-1.c
1 /* Test obsolete forms of designated initializers.  Test with default
2    warning options: valid forms are accepted, while ".member" without
3    "=" should not be (bug 16667).  */
4 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "" } */
7 struct s { int a; };
8 struct s s0 = { .a = 1 };
9 struct s s1 = { a: 1 };
10
11 int x0[] = { [0] = 1 };
12 int x1[] = { [0] 1 };
13
14 /* Invalid syntax: multiple designators without "=".  */
15 int x2[2][2] = { [0][0] 1 }; /* { dg-error "syntax error|parse error|expected" } */
16
17
18 /* Invalid syntax: C99-style structure designator without "=".  */
19 struct s s2 = { .a 1 }; /* { dg-error "syntax error|parse error|expected" } */