You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Sema] Reword warning for constant captures that are not required
This is one of the darker corners of C++, make it clear that this is
about constants and rephrase it a bit.
Before: lambda capture 'i' is not required to be captured for this use
After: lambda capture of constant 'i' is not required for this use
llvm-svn: 337152
Copy file name to clipboardExpand all lines: clang/test/SemaCXX/warn-unused-lambda-capture.cpp
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -41,9 +41,9 @@ void test() {
41
41
auto explicit_by_value_used = [i] { return i + 1; };
42
42
auto explicit_by_value_used_void = [i] { (void)i; };
43
43
auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 'i' is not used}}
44
-
auto explicit_by_value_unused_sizeof = [i] { returnsizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}}
45
-
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}}
46
-
auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}}
44
+
auto explicit_by_value_unused_sizeof = [i] { returnsizeof(i); }; // expected-warning{{lambda capture of constant 'i' is not required for this use}}
45
+
auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture of constant 'i' is not required for this use}}
46
+
auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture of constant 'k' is not required for this use}}
47
47
48
48
auto explicit_by_reference_used = [&i] { i++; };
49
49
auto explicit_by_reference_unused = [&i] {}; // expected-warning{{lambda capture 'i' is not used}}
@@ -146,10 +146,10 @@ void test_templated() {
146
146
auto explicit_by_value_used_void = [i] { (void)i; };
147
147
148
148
auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 'i' is not used}}
149
-
auto explicit_by_value_unused_sizeof = [i] { returnsizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}}
149
+
auto explicit_by_value_unused_sizeof = [i] { returnsizeof(i); }; // expected-warning{{lambda capture of constant 'i' is not required for this use}}
150
150
auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture 'i' is not used}}
151
-
auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}}
152
-
auto explicit_by_value_unused_const_generic = [k](auto c) { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}}
151
+
auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture of constant 'k' is not required for this use}}
152
+
auto explicit_by_value_unused_const_generic = [k](auto c) { return k + 1; }; // expected-warning{{lambda capture of constant 'k' is not required for this use}}
153
153
154
154
auto explicit_by_reference_used = [&i] { i++; };
155
155
auto explicit_by_reference_unused = [&i] {}; // expected-warning{{lambda capture 'i' is not used}}
0 commit comments