summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/init-desig-obs-2.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-25 22:23:08 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-25 22:23:08 +0000
commitde296e5aaa7a148c3862edb2b71bfd514e907518 (patch)
treed85117008d821ebc849f31a386dc58b0e98b291e /gcc/testsuite/gcc.dg/init-desig-obs-2.c
parent58f1b650a6738934f58ae23c8b0f281de4397399 (diff)
downloadgcc-de296e5aaa7a148c3862edb2b71bfd514e907518.tar.gz
PR c/16667
* c-parse.in (array_designator): New. (designator): Use it. (initelt): Only permit array_designator without '=', not ".foo". testsuite: * gcc.dg/init-desig-obs-1.c, gcc.dg/init-desig-obs-2.c, gcc.dg/init-desig-obs-3.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89560 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/init-desig-obs-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/init-desig-obs-2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/init-desig-obs-2.c b/gcc/testsuite/gcc.dg/init-desig-obs-2.c
new file mode 100644
index 00000000000..04c3b1048e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/init-desig-obs-2.c
@@ -0,0 +1,11 @@
+/* Test obsolete forms of designated initializers. Test with
+ -pedantic. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -pedantic" } */
+struct s { int a; };
+struct s s0 = { .a = 1 };
+struct s s1 = { a: 1 }; /* { dg-warning "warning: obsolete use of designated initializer with ':'" } */
+
+int x0[] = { [0] = 1 };
+int x1[] = { [0] 1 }; /* { dg-warning "warning: obsolete use of designated initializer without '='" } */