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

--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:68da968e46e7603a4c11099a6c8dd5ad24e4f43e

commit r15-6701-g68da968e46e7603a4c11099a6c8dd5ad24e4f43e
Author: Marek Polacek <pola...@redhat.com>
Date:   Tue Jan 7 10:15:42 2025 -0500

    c++: ICE with MODIFY_EXPR in constexpr [PR118169]

    Here, cxx_eval_outermost_expression gets a sequence of initialization
    statements:

      D.2912.t = TARGET_EXPR <...>;
      TARGET_EXPR <D.2922, 1>;
      D.2922 = 0;

    the last of which wasn't converted to void and so we, since r15-6369,
    do not take the "if (VOID_TYPE_P (type))" path, and try to set
    D.2912 to false.

    The last statement comes from build_disable_temp_cleanup.
    convert_to_void is typically called from finish_expr_stmt, but we are
    adding the cleanup statement via add_stmt which doesn't convert to void.
    So I think we can use finish_expr_stmt instead.

            PR c++/118169

    gcc/cp/ChangeLog:

            * typeck2.cc (split_nonconstant_init): Call finish_expr_stmt
instead
            of add_stmt.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1y/constexpr-prvalue2.C: New test.

    Reviewed-by: Jason Merrill <ja...@redhat.com>

Reply via email to