https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66130
--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> --- (In reply to Manuel López-Ibáñez from comment #8) > (In reply to Paolo Carlini from comment #7) > > First blush I'm wondering if in this specific case we couldn't forward from > > dump_decl to dump_expr and just print ‘l->*ptr’. AFAICS, wouldn't be a > > regression and would allow us to adopt immediately Manuel' patch. > > I could simply do > > if (DECL_P(expr)) error("%qD") else error("%qE") Sure. > but I was trying to avoid %qE because I think pretty-printing user coded > expressions is something we should always avoid since they usually do not > come out as written by the user. In general, I know that ;) > I would prefer to print: > > error: invalid use of non-static member function 'void (Local::*ptr)()' > > which tells the user that ->*ptr is a pointer to member-function. But the error message is about l->*ptr, not about ptr per se. Thus I think that in such cases using dump_type (or %qT at the call site) on TREE_TYPE (t) (TREE_TYPE (expr)) should be Ok.