https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86678

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Sat Sep  8 16:00:02 2018
New Revision: 264171

URL: https://gcc.gnu.org/viewcvs?rev=264171&root=gcc&view=rev
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-return4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c

Reply via email to