================ @@ -0,0 +1,55 @@ +.. title:: clang-tidy - readability-avoid-default-lambda-capture + +readability-avoid-default-lambda-capture +======================================== + +Warns on default lambda captures (e.g. ``[&](){ ... }``, ``[=](){ ... }``) + +Captures can lead to subtle bugs including dangling references and unnecessary +copies. Writing out the name of the variables being captured reminds programmers +and reviewers to know what is being captured. And knowing is half the battle. + +Coding guidelines that recommend against defaulted lambda captures include: + +* Item 31 of Effective Modern C++ by Scott Meyers +* `AUTOSAR C++ Rule A5-1-2 <https://www.mathworks.com/help//releases/ ---------------- jjmarr-amd wrote:
Thank you for the clarification. https://github.com/llvm/llvm-project/pull/160150 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits