aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/countof-vmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/countof-vmt.c')
-rw-r--r--gcc/testsuite/gcc.dg/countof-vmt.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/countof-vmt.c b/gcc/testsuite/gcc.dg/countof-vmt.c
new file mode 100644
index 0000000..67467b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/countof-vmt.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu2y" } */
+
+#define assert(e) ((e) ? (void) 0 : __builtin_abort ())
+
+void
+inner_vla_noeval (void)
+{
+ int i;
+
+ i = 3;
+ static_assert (_Countof (struct {int x[i++];}[3]) == 3);
+ assert (i == 3);
+}
+
+int
+main (void)
+{
+ inner_vla_noeval ();
+}