PR c++/86678 - constexpr function with non-constant after return.
authorJason Merrill <jason@redhat.com>
Sat, 8 Sep 2018 16:00:02 +0000 (12:00 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 8 Sep 2018 16:00:02 +0000 (12:00 -0400)
commit3075affdbcb3232fe549fbeed87bd94114c14758
tree86657620d81c1d04427d724399e476545acab7d9
parent61856507f42eef2a1474d4b629ed7db641b48a4f
PR c++/86678 - constexpr function with non-constant after return.

In this testcase, the call to f() can never be a constant
expression, but that's not a problem because it isn't always
reached by calls to g.  We were wrongly rejecting this because
potential_constant_expression_1 lacked the jump tracking that
cxx_eval_constant_expression has.  So this patch adds a simpler
version of that tracking.

* constexpr.c (potential_constant_expression_1): Add jump_target.
(breaks): Check for BREAK_STMT.
(continues): Check for CONTINUE_STMT.

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