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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <[email protected]>:

https://gcc.gnu.org/g:9badb670e28dae8c5a98ac3217eb16dfac20d38c

commit r16-5501-g9badb670e28dae8c5a98ac3217eb16dfac20d38c
Author: Daniele Sahebi <[email protected]>
Date:   Wed Nov 19 17:03:05 2025 +0100

    c++: fix ICE with consteval functions in template decls [PR122658]

    Currently, build_over_call calls build_cplus_new in template decls,
generating
    a TARGET_EXPR that it then passes to fold_non_dependent_expr, which ends up
    calling tsubst_expr, and since tsubst_expr doesn't handle TARGET_EXPRs, it
ICEs.

    Since there is no way for this code path to be executed without causing an
    ICE, I believe it can be removed.

            PR c++/122658

    gcc/cp/ChangeLog:

            * call.cc (build_over_call): Don't call build_cplus_new in
            template declarations.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/consteval42.C: New test.

    Co-authored-by: Jakub Jelinek <[email protected]>
    Signed-off-by: Daniele Sahebi <[email protected]>
    Reviewed-by: Marek Polacek <[email protected]>
    Reviewed-by: Patrick Palka <[email protected]>

Reply via email to