From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D92393846411; Thu, 27 May 2021 06:04:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D92393846411 From: "kretz at kde dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100716] member function template parameter should never be printed in candidate list and "T = T" should never be shown in substitutions Date: Thu, 27 May 2021 06:04:06 +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: 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: attachments.created 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: Thu, 27 May 2021 06:04:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100716 --- Comment #3 from Matthias Kretz (Vir) --- Created attachment 50877 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50877&action=3Dedit proposed patch Ensure dump_template_decl for function templates never prints template parameters after the function name (it did with -fno-pretty-templates) and skip output of irrelevant & confusing "[with T =3D T]" in dump_substitution. gcc/cp/ChangeLog: PR c++/100716 * error.c (dump_template_bindings): Include code to print "[with" and ']', conditional on whether anything is printed at all. This is tied to whether a semicolon is needed to separate multiple template parameters. If the template argument repeats the template parameter (T =3D T), then skip the parameter. (dump_substitution): Moved code to print "[with" and ']' to dump_template_bindings. (dump_function_decl): Partial revert of PR50828, which masked TFF_TEMPLATE_NAME for all of dump_function_decl. Now TFF_TEMPLATE_NAME is masked for the scope of the function and only carries through to dump_function_name. (dump_function_name): Avoid calling dump_template_parms if TFF_TEMPLATE_NAME is set. gcc/testsuite/ChangeLog: PR c++/100716 * g++.dg/diagnostic/pr100716.C: New test. * g++.dg/diagnostic/pr100716-1.C: Same test with -fno-pretty-templates. --- gcc/cp/error.c | 59 +++++++++++++++----- gcc/testsuite/g++.dg/diagnostic/pr100716-1.C | 54 ++++++++++++++++++ gcc/testsuite/g++.dg/diagnostic/pr100716.C | 54 ++++++++++++++++++ 3 files changed, 152 insertions(+), 15 deletions(-) create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr100716-1.C create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr100716.C=