[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; }();
+ }
+};
+
+struct B {
+ int a;
+ void foo() {
+ auto b = [a = this->a] {
----------------
shafik wrote:
```suggestion
auto b = [a = this->a] { // no diagnostic, init-capture does not shadow a
```
https://github.com/llvm/llvm-project/pull/74512
More information about the cfe-commits
mailing list