https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109923
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:38af81df6aac11d49f9378d1c628ccc3c815c3ff commit r14-1519-g38af81df6aac11d49f9378d1c628ccc3c815c3ff Author: Patrick Palka <ppa...@redhat.com> Date: Sat Jun 3 09:26:43 2023 -0400 c++: is_specialization_of_friend confusion [PR109923] The check for a non-template member function of a class template in is_specialization_of_friend is overbroad, and accidentally holds for a non-template hidden friend too, which for the testcase below causes the predicate to bogusly return true for decl = void non_templ_friend(A<int>, A<void>) friend_decl = void non_templ_friend(A<void>, A<void>) This patch refines the check appropriately. PR c++/109923 gcc/cp/ChangeLog: * pt.cc (is_specialization_of_friend): Fix overbroad check for a non-template member function of a class template. gcc/testsuite/ChangeLog: * g++.dg/template/friend79.C: New test.