[clang] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 5 13:57:04 PST 2023
================
@@ -179,3 +179,21 @@ void f() {
#endif
}
}
+
+namespace GH71976 {
+struct A {
+ int b = 5;
+ int foo() {
+ return [b = b]() { return b; }();
----------------
shafik wrote:
```suggestion
return [b = b]() { return b; }(); // no diagnostic, init-capture does not shadow b
```
https://github.com/llvm/llvm-project/pull/74512
More information about the cfe-commits
mailing list