[libcxx-commits] [mlir] [clang] [llvm] [libcxxabi] [clang-tools-extra] [libc] [compiler-rt] [openmp] [flang] [libcxx] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)

Mariya Podchishchaeva via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 11 02:56:01 PST 2023


Fznamznon wrote:

> The whole point of the shadowing warning is to avoid confusion about which variable is actually used, which IMO could very well be the case here. 

In the case that is being fixed, a field is not available in lambda's body without capturing this, so there is no such confusion and no shadowing, I think. 
I have a concern, that probably in case when `this` is actually captured, with current implementation there will be no warning as well. Should it be? gcc doesn't give a warning in both cases.

https://github.com/llvm/llvm-project/pull/74512


More information about the libcxx-commits mailing list