aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gnu-compoundlit-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/gnu-compoundlit-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/gnu-compoundlit-1.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gnu-compoundlit-1.c b/gcc/testsuite/gcc.dg/gnu-compoundlit-1.c
new file mode 100644
index 0000000..a7f3496
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu-compoundlit-1.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu23" } */
+
+int g(int n, int (*p)[n]);
+int f(int n)
+{
+ return g(n, &(int[n]){ });
+}
+
+void h(int n)
+{
+ (int[n]){ 1 }; /* { dg-error "empty initializer" } */
+}
+
+void i(int n)
+{
+ (static int[3]){ };
+ (static int[n]){ }; /* { dg-error "storage size" } */
+ (constexpr int[3]){ };
+ (constexpr int[n]){ }; /* { dg-error "storage size" } */
+ (register int[3]){ }; /* { dg-error "register" } */
+ (register int[n]){ }; /* { dg-error "register" } */
+ (_Thread_local int[3]){ }; /* { dg-error "_Thread_local" } */
+ (_Thread_local int[n]){ }; /* { dg-error "_Thread_local" } */
+}
+