Fixed by r264171. Tested x86_64-pc-linux-gnu, applying to trunk.
PR c++/86327 * g++.dg/cpp1y/constexpr-return5.C: New test. --- gcc/testsuite/g++.dg/cpp1y/constexpr-return5.C | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-return5.C 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++; +} base-commit: f883c46b4877f637e0fa5025b4d6b5c9040ec566 -- Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA