aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C
new file mode 100644
index 00000000000..5e7c3c97dc2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop3.C
@@ -0,0 +1,23 @@
+// { dg-do compile { target c++14 } }
+
+struct A
+{
+ int i;
+};
+
+constexpr bool f()
+{
+ A ar[4] = { 1, 2, 3, 4 };
+ A *ap = ar;
+ int i = 0;
+ do
+ *ap++ = A{i};
+ while (++i < 3);
+ return (ar[0].i == 0
+ && ar[1].i == 1
+ && ar[2].i == 2
+ && ar[3].i == 4);
+}
+
+#define SA(X) static_assert((X),#X)
+SA(f());