This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] v2: Don't offer suggestions for compiler-generated variables (PR c++/85515)
- From: Jason Merrill <jason at redhat dot com>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Nathan Sidwell <nathan at acm dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 27 Apr 2018 12:39:15 -0400
- Subject: Re: [PATCH] v2: Don't offer suggestions for compiler-generated variables (PR c++/85515)
- References: <CADzB+2knOmfk=JB3aOzBLeSJR2iRBo2H184BhTnj8Cn9n+8aeQ@mail.gmail.com> <1524787750-31142-1-git-send-email-dmalcolm@redhat.com>
On Thu, Apr 26, 2018 at 8:09 PM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Thu, 2018-04-26 at 15:53 -0400, Jason Merrill wrote:
>> On Thu, Apr 26, 2018 at 3:45 AM, Richard Biener
>> <richard.guenther@gmail.com> wrote:
>> > On Wed, Apr 25, 2018 at 7:10 PM, Nathan Sidwell <nathan@acm.org>
>> > wrote:
>> > > On 04/25/2018 11:41 AM, David Malcolm wrote:
>> > > >
>> > > > Jason Turner's video C++ Weekly - Ep 112 - GCC's Leaky
>> > > > Abstractions shows
>> > > > two issues where g++ offers suggestions about implementation
>> > > > details:
>> > >
>> > >
>> > > > For the lambda capture case, there are multiple members:
>> > > >
>> > > > $9 = <function_decl 0x7ffff1a1dd00 __ct >
>> > >
>> > >
>> > > These names have a space at the end, so the user cannot name
>> > > them. We could
>> > > move the space to the beginning, if that helps?
>> >
>> > I think compiler-generated entities that are not supposed to be
>> > user-visible should be DECL_ARTIFICIAL.
>>
>> Agreed, add_capture should set that flag on the FIELD_DECLs.
>
> I had tried flagging the lambda-captured vars as DECL_ARTIFICIAL,
> but it lead to a "too many initializers" error from reshape_init,
> so (before I saw your email), I tried the following approach: rather
> than looking at underscores, it uses is_lambda_ignored_entity (similar
> to qualify_lookup without LOOKUP_HIDDEN).
>
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
>
> Do you want me to do the DECL_ARTIFICAL approach, or is this OK?
This is OK.