[Bug c++/124927] ICE: in force_target_expr, at cp/tree.cc:1034 when iterating over zip_view in expansion statement

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 21 16:32:33 GMT 2026


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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:e793b563ef52f5442d97695a50027c7e62f31da0

commit r16-8783-ge793b563ef52f5442d97695a50027c7e62f31da0
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Apr 21 18:31:36 2026 +0200

    c++: Fix up iterating expansion stmt b and e var handling [PR124927]

    The following testcase ICEs, because the TARGET_EXPR it had has VOID_TYPE
    TARGET_EXPR_INITIAL and force_target_expr obviously ICEs when trying to
    create a VOID_TYPE TARGET_EXPR.

    This patch fixes it by taking the cv_unqualified type of the TARGET_EXPRs
    before we extract their TARGET_EXPR_INITIAL, so it does the desirable thing
    of recreating the TARGET_EXPRs with cv unqualified types.

    2026-04-21  Jakub Jelinek  <jakub@redhat.com>

            PR c++/124927
            * pt.cc (finish_expansion_stmt): Compute types for
force_target_expr
            from b and e before extracting TARGET_EXPR_INITIAL from it.

            * g++.dg/cpp26/expansion-stmt41.C: New test.

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


More information about the Gcc-bugs mailing list