Hi,

On 08/07/2018 00:09, Ville Voutilainen wrote:
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?
Sounds pretty good to me, I think this is the way to go but I'm not sure about the details...
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.
... indeed and that annoys me a bit. Not having studied at all c++/79133 so far (sorry) it seems a little weird to me that according to the standard we have to handle the two types of "shadowing" in different ways, one more strict, one less. Thus I would suggest double checking the details of that, eventually with Jason too in terms of the actual patch you would like to apply.

Paolo.

Reply via email to