zwuis wrote:

Oh, I missed "-Wshadow-uncaptured-local". Thanks for pointing out!

> IIUC we shouldn't emit any warning on "lambda captures shadow something". It 
> is a better approach for me that removing emitting this warning and 
> performing code cleanup (there must be some checks preventing false positive 
> with shadowing variables).

So this is wrong.

> My fix was focused on the simplest solution to make behavior consistent for 
> the most popular case (basic `-Wshadow`). A proper fix should probably 
> preserve the `uncaptured-local` warning classification for structured 
> bindings rather than suppressing all shadow warnings, but that would require 
> more complex changes to the warning classification logic.

So current fix will introduce false negative with `-Wshadow-uncaptured-local` 
and shadowing structured bindings, and, **hide the underlying issue**. It would 
be great to explore the difference of handling shadowing `VarDecl` and 
`BindingDecl`.

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

Reply via email to