c++: Add test for PR 86327.
authorMarek Polacek <polacek@redhat.com>
Sat, 11 Apr 2020 14:45:33 +0000 (10:45 -0400)
committerMarek Polacek <polacek@redhat.com>
Sat, 11 Apr 2020 14:45:33 +0000 (10:45 -0400)
Fixed by r264171.

PR c++/86327
* g++.dg/cpp1y/constexpr-return5.C: New test.

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

index fa09a7d2877146a919dba025f0e3391a73dc424b..460e6bd43d8844c41e0422398665bfff851dcf17 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-11  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/86327
+       * g++.dg/cpp1y/constexpr-return5.C: New test.
+
 2020-04-11  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/94494
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-return5.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-return5.C
new file mode 100644 (file)
index 0000000..e8de5ed
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/86327
+// { dg-do compile { target c++14 } }
+
+int global = 0;
+
+constexpr int
+f (bool arg)
+{
+  if (arg)
+    return 1;
+  return global++;
+}