[clang] [Clang] Check for uninitialized use in lambda within CXXOperatorCallExpr (PR #129198)

via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 9 23:50:16 PDT 2025


================
@@ -892,6 +892,11 @@ namespace lambdas {
       return a1.x;
     });
     A a2([&] { return a2.x; }); // ok
+    A a3([=] { return a3.x; }()); // expected-warning{{variable 'a3' is uninitialized when used within its own initialization}}
----------------
zhaohuiw42 wrote:

I think not, `SelfReferenceChecker` only checks whether the declaration is evaluated in its own initialization, an additional value-tracking mechanism is needed for the case you mentioned.

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


More information about the cfe-commits mailing list