[clang] [clang][analyzer] Correctly handle structured bindings captured by lambda (PR #132579)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 24 10:07:05 PDT 2025


================
@@ -0,0 +1,15 @@
+// RUN: %clang_analyze_cc1 -std=c++20 %s -analyzer-checker=core.NullDereference -analyzer-output=text -verify
+
+// expected-no-diagnostics
+
+struct S { int x; };
+
+void f(int x) { (void)x; }
+
+int main()
+{
+    S s{42};
+    auto& [x] = s;
+    auto g = [x](){ f(x); }; // no warning
+    g();
+}
----------------
isuckatcs wrote:

Please include a newline at the end of the file.

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


More information about the cfe-commits mailing list