On 8 July 2018 at 00:35, Paolo Carlini <paolo.carl...@oracle.com> wrote:
> Hi,
>
> On 07/07/2018 23:20, Ville Voutilainen wrote:
>>
>> +           error_at (DECL_SOURCE_LOCATION (old),
>> +                     "capture %qD and lambda parameter %qD "
>> +                     "have the same name",
>> +                     decl, old);
>
> Let's consider, say (with -Wshadow):
>
> int main() {
>   int x = 42;
>   auto lambda0 = [x]() { int x; };
> }
>
> I'm thinking that the new diagnostic should be more consistent with it.

There are a couple of errors that do an "error: redeclaration of foo"
followed by an inform "previously declared here". I would suggest that I do
an "error: declaration of parameter foo"
followed by an inform "previously declared as a capture here". How
does that sound?
That would make this more consistent with such a shadow warning, but I
don't want
to use the shadowing wording (which would be easy to do; just set
'shadowed' and do
a 'goto inform'), because this isn't shadowing in the precise sense;
the shadowing cases
are warnings, whereas this is more like the redeclaration errors in
the same function.

Reply via email to