[clang-tools-extra] [clang-tidy] Add bugprone-default-lambda-capture (PR #160150)
Congcong Cai via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 23 22:34:25 PDT 2025
https://github.com/HerrCai0907 commented:
If it is bugprone, I think we should do more anlysis, e.g ensure this lambda is not leak out of scope because of used as return value,...
It is common usage to use default capture like
```c++
template<class Fn> void forEach(Fn &&fn);
forEach([&]() {
// ...
};
```
We should not simply disable default capture as bug-prone here. IMO, bugprone is the most critical check category.
Maybe put it in readability and add some comment / issue to move it back when we support this kind of leak detection (I am not sure whether is it possible in clang-tidy's scope)
https://github.com/llvm/llvm-project/pull/160150
More information about the cfe-commits
mailing list