From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6031D3847824; Fri, 21 May 2021 15:21:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6031D3847824 From: "kretz at kde dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100716] New: member function template parameter not printed in candidate list Date: Fri, 21 May 2021 15:21:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: kretz at kde dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone Message-ID: 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: Fri, 21 May 2021 15:21:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100716 Bug ID: 100716 Summary: member function template parameter not printed in candidate list Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kretz at kde dot org CC: paolo.carlini at oracle dot com Target Milestone: --- template struct A { template void f() { } }; int main() { A().f(0); } With -fpretty-templates this prints: : In function 'int main()': :8:6: error: no matching function for call to 'A::f(int)' :4:12: note: candidate: 'template void A::f() [with U = =3D U; T =3D void]' [...] >>From the diagnostics, it is not apparent what entity U applies to. Also 'wi= th U =3D U' is unnecessary noise. It should be: :4:12: note: candidate: 'template void A::f() [with = T =3D void]' However, template struct A { template void f(U) { } }; int main() { A().f(); } doesn't need to show the function template parameter and should be diagnosed as: :4:12: note: candidate: 'template void A::f(U) [with T = =3D void]' However, to distinguish the two cases, cp/error.c would need to determine whether the function template parameters are deducible. Alternatively, it w= ould have to look at the list of function parameters and check whether all templ= ate parameters are used somehow (even if not deducible). Not sure whether that's worth the effort. I assume the current behavior was chosen because the majo= rity of function template parameters are deducible? FWIW, I believe the fix for PR50828 was incorrect since it removes the abil= ity to control whether dump_template_parms called from dump_function_decl retur= ns early for primary templates or not. I think the flags need to be modified f= or printing the function's scope, but not for dump_function_decl. I'll try to come up with a patch.=