[Bug c++/127207] [modules] ICE: tree check: expected template_decl, have identifier_node in decl_value at cp/module.cc:8390 - class template with a friend declaration that forward-references a function-template specialization

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Sep 5 03:01:37 GMT 2026


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

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

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

commit r17-3941-gdad0fca70f5a35b1016189eb544ea729b0144417
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Sep 4 23:00:29 2026 -0400

    c++/modules: handle tinfo with identifier as template [PR127207]

    A couple of sanity checks need to be made robust to TEMPLATE_INFO that
    has IDENTIFIER_NODE as its TI_TEMPLATE, which is how we express the
    friend template specialization createFoo<T>() when there is no existing
    declaration of createFoo.

            PR c++/127207

    gcc/cp/ChangeLog:

            * module.cc (trees_out::decl_value): Relax checking assert
            to accept IDENTIFIER_NODE as TI_TEMPLATE.
            (get_originating_module_decl): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/friend-15_a.H: New test.
            * g++.dg/modules/friend-15_b.C: New test.

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


More information about the Gcc-bugs mailing list