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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:0dfbb28a9549c2503204b0338bf550f1bff9c681

commit r13-6992-g0dfbb28a9549c2503204b0338bf550f1bff9c681
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon Apr 3 18:23:58 2023 -0400

    c++: friend template matching [PR107484]

    Here friend matching tries to find a matching non-template friend and
fails,
    so we mark the friend as a template specialization to be determined later.
    Then cplus_decl_attributes tries again to find a matching function and gets
    confused by DECL_TEMPLATE_INSTANTIATION without DECL_TEMPLATE_INFO.  But it
    doesn't make sense for find_last_decl to be trying to match anything with
    DECL_USE_TEMPLATE set; those are matched elsewhere.

            PR c++/107484

    gcc/cp/ChangeLog:

            * decl2.cc (find_last_decl): Return early if DECL_USE_TEMPLATE.

    gcc/testsuite/ChangeLog:

            * g++.dg/lookup/friend25.C: New test.

Reply via email to