On 5/27/21 11:25 AM, Matthias Kretz wrote:
On Thursday, 27 May 2021 17:07:40 CEST Jason Merrill wrote:
On 5/26/21 5:29 PM, Matthias Kretz wrote:
New revision which can also be compiled with GCC 4.8.

From: Matthias Kretz <kr...@kde.org>

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 = 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 = T), then skip the parameter.

This description should really be in a comment in the code, rather than
the ChangeLog.  OK either way.

Added comments in the code. New patch below.

Applied with missing spaces before () added.

From: Matthias Kretz <kr...@kde.org>

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 = 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 = 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                               | 63 +++++++++++++++-----
  gcc/testsuite/g++.dg/diagnostic/pr100716-1.C | 54 +++++++++++++++++
  gcc/testsuite/g++.dg/diagnostic/pr100716.C   | 54 +++++++++++++++++
  3 files changed, 156 insertions(+), 15 deletions(-)
  create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr100716-1.C
  create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr100716.C


--
──────────────────────────────────────────────────────────────────────────
  Dr. Matthias Kretz                           https://mattkretz.github.io
  GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
  std::experimental::simd              https://github.com/VcDevel/std-simd
──────────────────────────────────────────────────────────────────────────


Reply via email to