diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/c11-empty-init-3.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/c11-empty-init-3.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c11-empty-init-3.c b/gcc/testsuite/gcc.dg/c11-empty-init-3.c new file mode 100644 index 0000000..fd43fa7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-empty-init-3.c @@ -0,0 +1,25 @@ +/* Test C11 does not support empty initializers. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -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" } */ +} |