From 6f43a8a08053a871e785e2ebc80383e0849efb6f Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 30 Nov 2021 16:43:19 -0500 Subject: c++: ICE with unnamed tparm and concept [PR103408] Here we crash when issuing the "constraint C has type T, not bool" error, because pp_cxx_parameter_mapping wasn't prepared to see an anonymous template parameter. With this patch we print error: constraint 'auto() [with = 0]' has type '', not 'bool' The "" is what this patch adds. PR c++/103408 gcc/cp/ChangeLog: * cxx-pretty-print.c (pp_cxx_parameter_mapping): Print "" rather than crash on an unnamed template parameter. gcc/testsuite/ChangeLog: * g++.dg/cpp23/concepts-err1.C: New test. --- gcc/cp/cxx-pretty-print.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/cp/cxx-pretty-print.c') diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 25cabfe..3ea357d 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -2891,8 +2891,10 @@ pp_cxx_parameter_mapping (cxx_pretty_printer *pp, tree map) if (TYPE_P (parm)) pp->type_id (parm); + else if (tree name = DECL_NAME (TEMPLATE_PARM_DECL (parm))) + pp_cxx_tree_identifier (pp, name); else - pp_cxx_tree_identifier (pp, DECL_NAME (TEMPLATE_PARM_DECL (parm))); + pp->translate_string (""); pp_cxx_whitespace (pp); pp_equal (pp); -- cgit v1.1