<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61970>61970</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] `move-const-arg` false positive
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
timblechmann
</td>
</tr>
</table>
<pre>
i have lots of code where i'm moving objects into a lambda capture using the same name inside the capture as outside:
```
auto foo(std::shared_ptr<int> i)
{
return [i = std::move(i)]{};
}
```
clang-tidy gives me:
```
warning: std::move of the const variable 'i' has no effect; remove std::move() or make the variable non-const [performance-move-const-arg]
```
i guess it refers to `i` as the variable in the lambda capture, not the variable (in the example the function parameter), which is moved into the capture
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0U9tuqzoQ_RrzMkrkmFt44KEpJ79xZMwAc44vyDZ09--3DE3bVHtLyGCz1njNmhkZAk0WsWXljZVdJtc4O99GMr1GNRtpbda74b0lmOWGoF0M4EZQbkB4m9EjEBO1AeM2shO4_j9UMQDZ6ECClqYfJCi5xNUjrCFh4owQpEGwaSEbaMD98AGTAdwa0zHLXxjvGH-sFf949q1co4PROSauIQ4Jm7-EWXoc_l2iZ_kr2cjyf5LC5iNAfTs-AAA8xtVbYOWNgOUdfMYwbkMmrjut7BKn7lh-e4To_ijmWJWWdjpFGt5hog0DmG85PBPepLdkJ5a_PN-c7N3dcDZE2KQn2WsEJurkNMwygHWA44gqsvwGHnfWT_VMNOA8GPn_Ye5nIOvs6YjNytuCfnTeSKvwlIjHn5P0U8r873kSTCuGABTB44g-QHTAKk6s4ql-TzeS3ffPzcDEK1gXn5HJ9QOMv6RZ9CF9XK2K5Cws0kuDEX2qjHiFt5nUDBRS9-FwNN23RsqGNh-avJEZtpfqyutSNKLK5rYXBW_GUtWXsi4LpSo-ipHzspFqqCu8ZtQKLnJe8IrnxbWozrmqVd8U1aUZLo26jKzgaCTps9abOTs_ZRTCim11aWqeadmjDo-Z8m0Cnfp1CqzgmkIMX7RIUe_T99U5rOySlT_KUXEYpQ4IiwsUacNs9bqdY1xCqru4M3GfKM5rf1bOMHFPV3y8Tot3aS6ZuO8yAxP3XenvAAAA__8pKEDo">