Message ID | 20201001214905.3195181-1-polacek@redhat.com |
---|---|
State | New |
Headers | show |
Series | c++: Fix printing of C++20 template parameter object [PR97014] | expand |
On 10/1/20 5:49 PM, Marek Polacek wrote: > No one is interested in the mangled name of the C++20 template parameter > object for a class NTTP. So instead of printing > > required for the satisfaction of ‘positive<T::ratio>’ [with T = X<::_ZTAXtl5ratioLin1ELi2EEE>] > > let's print > > required for the satisfaction of ‘positive<T::ratio>’ [with T = X<{-1, 2}>] > > I don't think adding a test is necessary for this. OK. > gcc/cp/ChangeLog: > > PR c++/97014 > * cxx-pretty-print.c (pp_cxx_template_argument_list): If the > argument is template_parm_object_p, print its DECL_INITIAL. > --- > gcc/cp/cxx-pretty-print.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c > index d10c18db039..8bea79b93a2 100644 > --- a/gcc/cp/cxx-pretty-print.c > +++ b/gcc/cp/cxx-pretty-print.c > @@ -1910,6 +1910,8 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t) > if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL > && TYPE_P (DECL_TEMPLATE_RESULT (arg)))) > pp->type_id (arg); > + else if (template_parm_object_p (arg)) > + pp->expression (DECL_INITIAL (arg)); > else > pp->expression (arg); > } > > base-commit: dfaa24c974bab4bc1bd3840d67ca1701acc0010c >
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index d10c18db039..8bea79b93a2 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -1910,6 +1910,8 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t) if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL && TYPE_P (DECL_TEMPLATE_RESULT (arg)))) pp->type_id (arg); + else if (template_parm_object_p (arg)) + pp->expression (DECL_INITIAL (arg)); else pp->expression (arg); }