]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/59855 (Support sparse-style __attribute__((designated_init)) on structures...
authorMarek Polacek <polacek@redhat.com>
Sat, 2 Aug 2014 05:52:30 +0000 (05:52 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 2 Aug 2014 05:52:30 +0000 (05:52 +0000)
PR c/59855
* gcc.dg/Wdesignated-init-2.c: New test.

From-SVN: r213515

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wdesignated-init-2.c [new file with mode: 0644]

index 81b20e0763a5d9b335204f2b17d984397857d37e..13b632337504a5ce0a73751eab8edce457c19a7e 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-02  Marek Polacek  <polacek@redhat.com>
+
+       PR c/59855
+       * gcc.dg/Wdesignated-init-2.c: New test.
+
 2014-08-01  Paolo Carlini  <paolo.carlini@oracle.com>
 
        DR 217 again
diff --git a/gcc/testsuite/gcc.dg/Wdesignated-init-2.c b/gcc/testsuite/gcc.dg/Wdesignated-init-2.c
new file mode 100644 (file)
index 0000000..d5edfba
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR c/59855 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu11" } */
+
+struct S {
+    int a;
+    union {
+        int b;
+        int c;
+    };
+} __attribute__((designated_init));
+
+struct S s1 = { .a = 0, .b = 0 };
+struct S s2 = { 0, 0 }; /* { dg-warning "(positional|near initialization)" } */
+struct S s3 = { .a = 5, 0 }; /* { dg-warning "(positional|near initialization)" } */