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

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

https://gcc.gnu.org/g:43f60f5755293dfb829f9cca54ba531488be062c

commit r15-10560-g43f60f5755293dfb829f9cca54ba531488be062c
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]>
    (cherry picked from commit 9badb670e28dae8c5a98ac3217eb16dfac20d38c)

Reply via email to