re PR c++/89785 (Incorrect "not a constant expression" error with switch statement...
authorJakub Jelinek <jakub@redhat.com>
Thu, 28 Mar 2019 14:47:47 +0000 (15:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 28 Mar 2019 14:47:47 +0000 (15:47 +0100)
commitc7a53bdbb164f5a216f13801c1abbaa8c08c81f1
treebbbb8cc67962bc2f9a803fcc432f20ac3ff2e284
parent12b9247b19b8b634ec467ba8a3f506a4e7b76711
re PR c++/89785 (Incorrect "not a constant expression" error with switch statement that returns)

PR c++/89785
* constexpr.c (struct check_for_return_continue_data): New type.
(check_for_return_continue): New function.
(potential_constant_expression_1) <case SWITCH_STMT>: Walk
SWITCH_STMT_BODY to find RETURN_EXPRs or CONTINUE_STMTs not nested
in loop bodies and set *jump_target to that if found.

* g++.dg/cpp1y/constexpr-89785-1.C: New test.
* g++.dg/cpp1y/constexpr-89785-2.C: New test.

From-SVN: r269995
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/constexpr-89785-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/constexpr-89785-2.C [new file with mode: 0644]