[lld] [clang]set invalid for lambda which missing capture `this` (PR #70432)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 06:14:37 PDT 2023


================
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -std=c++17 %s
+
+struct S {
+  int n;
+  int d = (4, []() { return n; }());  // expected-error {{'this' cannot be implicitly captured in this context}} \
+                                      // expected-note {{explicitly capture 'this'}}
+};
----------------
cor3ntin wrote:

Can you move that test to an existing file? Maybe test/SemaCXX/lambda-implicit-this-capture.cpp
(in a `GH67687` namespace)

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


More information about the llvm-commits mailing list