On 8 July 2018 at 01:54, Paolo Carlini <paolo.carl...@oracle.com> wrote: >> 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.
Well. The PR is about DR 2211 which, in simple terms, says that lambda parameters and captures cannot have the same name. See http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#2211 That's stricter than -Wshadow, but otherwise equally strict as the other error cases already handled in check_local_shadow. So I'll make this error case more consistent with the others. We already handle redeclaration errors slightly differently from shadowing warnings in that function.