[clang-tools-extra] [compiler-rt] [mlir] [libcxx] [openmp] [llvm] [libcxxabi] [clang] [libc] [flang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 18 09:18:54 PST 2024
Fznamznon wrote:
> Should we still emit shadowing warning in case lambda captured this and has an init-capture with the same name as a class field?
Yes, we should probably do that.
I'm struggling with detecting the following case:
```
struct A {
int b = 5;
int foo() {
return [b = b, this]() { return b; }();
}
};
```
Since init capture is checked for shadowing before this capture reached, lambda info doesn't yet know about incoming this capture.
https://github.com/llvm/llvm-project/pull/74512
More information about the cfe-commits
mailing list