From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 65949385803E; Sat, 9 Apr 2022 01:51:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65949385803E From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/91618] [9/10/11/12 Regression] template-id required to friend a function template, even for a qualified-id Date: Sat, 09 Apr 2022 01:51:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2022 01:51:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D91618 --- Comment #12 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:58586721c79f77224b8571a5dba732620d5546ab commit r12-8065-g58586721c79f77224b8571a5dba732620d5546ab Author: Jason Merrill Date: Wed Apr 6 23:46:53 2022 -0400 c++: friend implicit template instantiation [PR91618] This rule that for a friend with a qualified name we try to find a matching template was already in C++98, but it seems we never implement= ed it, and nobody reported it until 2019. This patch sets DECL_IMPLICIT_INSTANTIATION to signal to check_explicit_specialization that we want to find a template, like grokfndecl already did for explicit template args. check_classfn also needs to call it, as check_classfn is called after the call to check_explicit_specialization in grokfndecl, whereas the call to set_decl_namespace comes sooner. This inconsistency is inelegant, but safer at this point in the release cycle; I'll unify them in stage 1. PR c++/91618 PR c++/96604 gcc/cp/ChangeLog: * name-lookup.cc (set_decl_namespace): Set DECL_IMPLICIT_INSTANTIATION if no non-template match. * pt.cc (check_explicit_specialization): Check it. * decl2.cc (check_classfn): Call it. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/friend7.C: Remove xfail. * g++.dg/template/friend72.C: New test. * g++.dg/template/friend72a.C: New test. * g++.dg/template/friend73.C: New test.=