summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1y')
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-init11.C1
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr77539.C14
3 files changed, 43 insertions, 1 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C
new file mode 100644
index 00000000000..b924b3830dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-77553.C
@@ -0,0 +1,29 @@
+// PR c++/77553
+// { dg-do compile { target c++14 } }
+
+constexpr void
+bar (int *x)
+{
+ int i = 0;
+ x[i++] = 1;
+ x[3] = i;
+}
+
+constexpr int
+foo ()
+{
+ int a[] = { 0, 0, 0, 0 };
+ bar (a);
+
+ return a[0] + 8 * a[1] + 64 * a[2] + 512 * a[3];
+}
+
+constexpr int b = foo ();
+
+int
+main ()
+{
+ static_assert (b == 513, "");
+ if (foo () != 513)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C
index f7525d8664a..4d434cd9ca0 100644
--- a/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init11.C
@@ -16,5 +16,4 @@ int main(){
foo(3.14f);
foo(0);
foo('a');
- foo(false);
}
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr77539.C b/gcc/testsuite/g++.dg/cpp1y/pr77539.C
new file mode 100644
index 00000000000..d1fba24c625
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr77539.C
@@ -0,0 +1,14 @@
+// PR c++/77539
+// { dg-do compile { target c++14 } }
+
+constexpr int foobar()
+{
+ int array[100] = {};
+ int *ar = array;
+ if (ar == nullptr) // Error...
+ {
+ return 0;
+ }
+ return 1;
+}
+static_assert(foobar(),"");