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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:8895443a42db4045aad8e4b42cd5dd2ad6ffa7d7

commit r11-4542-g8895443a42db4045aad8e4b42cd5dd2ad6ffa7d7
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Oct 28 17:30:05 2020 -0400

    c++: Fix constexpr cleanup error handling.

    In this testcase, the primary evaluation successfully produces 'true', and
    then running one of the cleanups hits a double delete, making the whole
    thing not a valid constant expression.  So we were returning 'true' wrapped
    in a NOP_EXPR to indicate its non-constancy, but evaluating that again is a
    perfectly acceptable constant expression, so we weren't getting the verbose
    diagnostic we were looking for.

    So if non_constant_p gets set other than for overflow, go back to the
    original expression.

    With this change, we should never hit the manifestly_const_eval test, and
    the is-constant-evaluated1.C test passes without it.

    gcc/cp/ChangeLog:

            PR c++/97388
            * constexpr.c (cxx_eval_outermost_constant_expr): Revert to
            original expression if evaluation sets non_constant_p.

    gcc/testsuite/ChangeLog:

            PR c++/97388
            * g++.dg/cpp2a/constexpr-dtor8.C: New test.

Reply via email to