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
167167 Detects default initialization (to 0) of variables with ``enum `` type where
168168 the enum has no enumerator with value of 0.
169169
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+
170175- New :doc: `bugprone-derived-method-shadowing-base-method
171176 <clang-tidy/checks/bugprone/derived-method-shadowing-base-method>` check.
172177
@@ -203,15 +208,6 @@ New checks
203208 Finds virtual function overrides with different visibility than the function
204209 in the base class.
205210
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-
215211New check aliases
216212^^^^^^^^^^^^^^^^^
217213
Original file line number Diff line number Diff line change 33bugprone-default-lambda-capture
44===============================
55
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.
1111
1212Implements Item 31 of Effective Modern C++ by Scott Meyers.
1313
You can’t perform that action at this time.
0 commit comments