aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gnu23-constexpr-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/gnu23-constexpr-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/gnu23-constexpr-1.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gnu23-constexpr-1.c b/gcc/testsuite/gcc.dg/gnu23-constexpr-1.c
new file mode 100644
index 0000000..834f90e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gnu23-constexpr-1.c
@@ -0,0 +1,17 @@
+/* Test C23 constexpr. Valid code using GNU extensions, compilation tests. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu23" } */
+
+struct s { struct { int x, y; } x; };
+constexpr struct s v = { { 123, 150 } };
+int k;
+constexpr int a[200] = { [v.x.x ... v.x.y] = 7 };
+
+void
+f ()
+{
+ switch (k)
+ {
+ case v.x.x ... v.x.y: ;
+ }
+}