[clang-tools-extra] [clang-tidy] fix false positive in cppcoreguidelines-missing-std-forward (PR #77056)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 17:50:36 PST 2024


jcsxky wrote:

> I agree to fix false positive reported in #68105. But for capturing in lambda be reference and do forward in lambda, It is just like create a record by ref instead of using forward and do forward in some member function. I don't think it is an expected false positive.
> 
> ```c++
> template<typename T>
> void lambda_value_reference_capture_list_ref_2(T&& t) {
>     [&t] { T other = std::forward<T>(t); };
> }
> ```
> 
> @jcsxky @PiotrZSL Could you think again about this PR?

Not really. Capture by reference makes `t` in parameter same with it in lambda body. Maybe you can check https://github.com/llvm/llvm-project/issues/68105#issuecomment-1874796188 .












https://github.com/llvm/llvm-project/pull/77056


More information about the cfe-commits mailing list