philnik777 wrote:

> @philnik777 I agree strongly with @Fznamznon. If `this` is not captured there 
> is no actual shadowing in that they do not occupy encompassing scope, and so 
> removing one declaration would not give you access to the other variable.

I don't disagree that this is technically not shadowing, but I don't think 
that's clear from a users perspective. e.g.

```c++
void someFunc(int someVal) {
  // assume 100 LoC here

  auto someLambda = [](int someVal) {
    // another 100 LoC here
    return someVal + 40; // IMO it's trivial to confuse this with the `someVal` 
from `someFunc`
  };
}
```
It looks like Clang even has a warning for this specific case and GCC considers 
it shadowing too: https://godbolt.org/z/Y16njoPxh, which makes me think that 
people want this - at least as a separate flag.


https://github.com/llvm/llvm-project/pull/74512
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to