aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c2x-empty-init-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/c2x-empty-init-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/c2x-empty-init-3.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c2x-empty-init-3.c b/gcc/testsuite/gcc.dg/c2x-empty-init-3.c
new file mode 100644
index 0000000..472f816
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-empty-init-3.c
@@ -0,0 +1,25 @@
+/* Test empty initializers diagnosed in C2X mode with -Wc11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+
+struct s { int a; };
+struct s s = {}; /* { dg-warning "empty initializer" } */
+int x = {}; /* { dg-warning "empty initializer" } */
+float y = {}; /* { dg-warning "empty initializer" } */
+void *p = {}; /* { dg-warning "empty initializer" } */
+union u { int a; long b; };
+union u z = {}; /* { dg-warning "empty initializer" } */
+int aa[2] = {}; /* { dg-warning "empty initializer" } */
+
+void
+f (int a)
+{
+ int vla[a] = {}; /* { dg-warning "empty initializer" } */
+ struct s as = {}; /* { dg-warning "empty initializer" } */
+ int ax = {}; /* { dg-warning "empty initializer" } */
+ float ay = {}; /* { dg-warning "empty initializer" } */
+ void *ap = {}; /* { dg-warning "empty initializer" } */
+ union u az = {}; /* { dg-warning "empty initializer" } */
+ int aaa[2] = {}; /* { dg-warning "empty initializer" } */
+ int t = (int) {}; /* { dg-warning "empty initializer" } */
+}