From 4ded16a7782fd3a9e7b37291d04bca596b00b8bd Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sat, 11 Apr 2020 10:45:33 -0400 Subject: [PATCH] c++: Add test for PR 86327. Fixed by r264171. PR c++/86327 * g++.dg/cpp1y/constexpr-return5.C: New test. --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1y/constexpr-return5.C | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-return5.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fa09a7d2877..460e6bd43d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-04-11 Marek Polacek + + PR c++/86327 + * g++.dg/cpp1y/constexpr-return5.C: New test. + 2020-04-11 Uroš Bizjak 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 index 00000000000..e8de5ed671e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-return5.C @@ -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++; +} -- 2.30.2