re PR c++/77539 (gcc-5/6: comparison of array to nullptr failure in constexpr (fixed...
authorNathan Sidwell <nathan@acm.org>
Wed, 14 Sep 2016 16:13:52 +0000 (16:13 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 14 Sep 2016 16:13:52 +0000 (16:13 +0000)
PR c++/77539
* g++.dg/cpp1y/pr77539.C: New.

From-SVN: r240138

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr77539.C [new file with mode: 0644]

index 636f031b3db96e106741d77dee15747171a5b3c0..e394dcd92f5e0e7c8953eb6867e75e21b3c7804c 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-14  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/77539
+       * g++.dg/cpp1y/pr77539.C: New.
+
 2016-09-14  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * g++.dg/cpp0x/lambda/lambda-mangle.C: Move dg-do directive before
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr77539.C b/gcc/testsuite/g++.dg/cpp1y/pr77539.C
new file mode 100644 (file)
index 0000000..d1fba24
--- /dev/null
@@ -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(),"");