Skip to content

Commit a99f16f

Browse files
committed
another test
1 parent 8fa3dc4 commit a99f16f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang_cc1 -fsyntax-only -Wunused-lambda-capture -Wused-but-marked-unused -Wno-uninitialized -verify -std=c++20 %s
2+
3+
void test() {
4+
int i;
5+
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}}
6+
explicit_by_value_unused_requires(1);
7+
}

clang/test/SemaCXX/warn-unused-lambda-capture.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ void test() {
4444
auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}}
4545
auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}}
4646
auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}}
47+
#if __cplusplus >= 202002L
48+
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}}
49+
explicit_by_value_unused_requires(1);
50+
#endif
4751

4852
auto explicit_by_reference_used = [&i] { i++; };
4953
auto explicit_by_reference_unused = [&i] {}; // expected-warning{{lambda capture 'i' is not used}}

0 commit comments

Comments
 (0)