c++: Improve printing of pointers-to-members [PR97406, PR85901]
This PR points out that when printing the parameter mapping for a
pointer-to-member-function, the output was truncated:
[with T = void (X::*]
Fixed by printing the abstract declarator for pointers-to-members in
cxx_pretty_printer::type_id. So now we print:
[with T = void (X::*)()]
But when I tried a pointer-to-data-member, I got
[with T = ‘offset_type’ not supported by simple_type_specifier)‘offset_type’ not supported by direct_abstract_declarator]
so had to fix that too so that we now print:
[with T = int X::*]
or
[with T = int (X::*)[5]]
when the type is an array type. Which is what PR85901 was about.
gcc/cp/ChangeLog:
PR c++/97406
PR c++/85901
* cxx-pretty-print.c (pp_cxx_type_specifier_seq): Handle OFFSET_TYPE.
(cxx_pretty_printer::abstract_declarator): Fix the printing of ')'.
(cxx_pretty_printer::direct_abstract_declarator): Handle OFFSET_TYPE.
(cxx_pretty_printer::type_id): Likewise. Print the abstract declarator
for pointers-to-members.
gcc/testsuite/ChangeLog:
PR c++/97406
PR c++/85901
* g++.dg/diagnostic/ptrtomem1.C: New test.
* g++.dg/diagnostic/ptrtomem2.C: New test.