This is the mail archive of the
mailing list for the GCC project.
Re: [C++ Patch] Three additional bitfield diagnostic tweaks (a regression fix included)
- From: Jason Merrill <jason at redhat dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 6 Dec 2018 10:11:29 -0500
- Subject: Re: [C++ Patch] Three additional bitfield diagnostic tweaks (a regression fix included)
- References: <firstname.lastname@example.org>
On 12/6/18 5:49 AM, Paolo Carlini wrote:
I'm bundling together 3 more. In attachment order:
1- Since we decided to explicitly print the wrong type, I suppose we
want to consistently do that in templates too.
2- Unfortunately I have to fix another buglet I recently introduced,
completely similar to c++/88222 fixed by Marek. Well, at least we will
not print anymore an empty '' when the unqualified_id is null because
the field is unnamed.
- error_at (declarator->id_loc,
- "%qE is neither function nor member function; "
- "cannot be declared friend", unqualified_id);
+ if (unqualified_id && declarator)
+ error_at (declarator->id_loc,
+ "%qE is neither function nor member function; "
+ "cannot be declared friend", unqualified_id);
+ error ("unnamed field is neither function nor member "
+ "function; cannot be declared friend");
I wonder if we want to use the 'name' variable here.
3- In the non-static case too, when from grokdeclarator we are calling
FIELD_DECL and passing the location as first argument, I think we want
to likewise pass declarator->id_loc when available.
- decl = build_decl (input_location,
+ decl = build_decl (declarator
+ ? declarator->id_loc
+ : input_location,
I think we want to put this in a local variable, to share with the
static case and probably other places in grokdeclarator.