comparison gcc/testsuite/gcc.dg/init-desig-obs-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
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" } */