File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,11 @@ New checks
167
167
Detects default initialization (to 0) of variables with ``enum `` type where
168
168
the enum has no enumerator with value of 0.
169
169
170
+ - New :doc: `bugprone-default-lambda-capture
171
+ <clang-tidy/checks/bugprone/default-lambda-capture>` check.
172
+
173
+ Warns on default lambda captures (e.g. ``[&](){ ... } ``, ``[=](){ ... } ``)
174
+
170
175
- New :doc: `bugprone-derived-method-shadowing-base-method
171
176
<clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
172
177
@@ -203,15 +208,6 @@ New checks
203
208
Finds virtual function overrides with different visibility than the function
204
209
in the base class.
205
210
206
- - New :doc: `bugprone-default-lambda-capture
207
- <clang-tidy/checks/bugprone/default-lambda-capture>` check.
208
-
209
- Finds lambda expressions that use default capture modes (``[=] `` or ``[&] ``)
210
- and suggests using explicit captures instead. Default captures can lead to
211
- subtle bugs including dangling references with ``[&] ``, unnecessary copies
212
- with ``[=] ``, and make code less maintainable by hiding which variables are
213
- actually being captured.
214
-
215
211
New check aliases
216
212
^^^^^^^^^^^^^^^^^
217
213
Original file line number Diff line number Diff line change 3
3
bugprone-default-lambda-capture
4
4
===============================
5
5
6
- Finds lambda expressions that use default capture modes ( ``[=] `` or ``[&] ``)
7
- and suggests using explicit captures instead. Default captures can lead to
8
- subtle bugs including dangling references with `` [&] ``, unnecessary copies
9
- with ``[=] ``, and make code less maintainable by hiding which variables are
10
- actually being captured.
6
+ Warns on default lambda captures (e.g. ``[&](){ ... } ``, ``[=](){ ... } ``)
7
+
8
+ Default captures can lead to subtle bugs including dangling references with
9
+ `` [&] ``, unnecessary copies with ``[=] ``, and make code less maintainable by
10
+ hiding which variables are actually being captured.
11
11
12
12
Implements Item 31 of Effective Modern C++ by Scott Meyers.
13
13
You can’t perform that action at this time.
0 commit comments