[clang] [clang-tools-extra] [llvm] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 06:20:19 PST 2024


================
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused-lambda-capture -Wused-but-marked-unused -Wno-uninitialized -verify -std=c++20 %s
+
+void test() {
+  int i;
+  auto explicit_by_value_unused_requires = [i] (auto) requires requires { i; } {}; // expected-warning{{lambda capture 'i' is not required to be captured for this use}}
----------------
HerrCai0907 wrote:

That would be interesting. I will try to do it later in festival.

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


More information about the cfe-commits mailing list