================
@@ -179,3 +179,64 @@ void f() {
#endif
}
}
+
+namespace GH71976 {
+#ifdef AVOID
+struct A {
+ int b = 5;
+ int foo() {
+ return [b = b]() { return b; }(); // no -Wshadow diagnostic, init-capture
does not shadow b due to not capturing this
+ }
+};
+
+struct B {
+ int a;
+ void foo() {
+ auto b = [a = this->a] {}; // no -Wshadow diagnostic, init-capture does
not shadow a due to not capturing his
+ }
+};
+
+struct C {
+ int b = 5;
+ int foo() {
+ return [a = b]() {
+ return [=, b = a]() { // no -Wshadow diagnostic, init-capture does not
shadow b due to outer lambda
+ return b;
----------------
cor3ntin wrote:
Should we test we get a warning for a?
https://github.com/llvm/llvm-project/pull/74512
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits