<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/150446>150446</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
cppcoreguidelines-missing-std-forward should consider std::forward usage in lambda capture also with uniform initialization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mous16
</td>
</tr>
</table>
<pre>
Following the issue https://github.com/llvm/llvm-project/issues/68105, I found out that clang-tidy still complains about forwarding in lambda capture, if lambda variable is initialized with braces instead of equal.
Example:
```c++
#include <utility>
template <typename F>
auto makeFuncA(F&& func) {
return [func2 = std::forward<F>(func)]() { func2(); };
}
template <typename F>
auto makeFuncB(F&& func) {
return [func2{std::forward<F>(func)}]() { func2(); };
}
int main() {
auto a{makeFuncA([]() {})};
a();
auto b{makeFuncB([]() {})};
b();
}
```
clang-tidy is ok with `makeFuncA`, while complains on `makeFuncB`.
`func2{std::forward<F>(func)}` should be considered the same of `func2 = std::forward<F>(func)`.
Live example: https://godbolt.org/z/barb17xM7
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVO2O4ygQfJr2n1YiDP7KD_-IJ2vppLuHAINtbjHkDEx29ulP2MlOtKvTzayEZBno6nK5urj3erJKtVB2UF4yHsPs1nZx0edVJpx8a3tnjLtpO2GYFWrvo8I5hKsHdgbaA-0nHeYojoNbgPbGvD4eh-vq_lZDANpvZR5oXzU5KYG-4B84umgluhgwzDzgYLidDkHLN_RBG4ODW66Ga-uRi3RrdOuNrzIx0RYNX4TkOPBriKtKiHp8bL7yVXNhElvUVgfNjf6uJN50mFGsfFBp3wfFJboR1T-RmyOQM5Dzl298uRqVvo2coSL7GoB2aZEzUKbtYKJUCOwlBm10eAP2Za8OKlEO21l4uyrLF4X9fsxjcLjwr6qPdjgDbXqgFdAKx2gHoCeEOjVARFxViKtFKLt0RhHYBX2QiRQ732UA9rIB0-ZeD-UFaHMH2kDp_g6sQ6gvwDb-9eWTVLv_pvoTT6i7_2dZXz5JVNuAC9f2vSa13ihyqLtnRXcTP12sL_eW7CEt_9HqsZGAxBNQ9wEg8YxyZ_rwys76yc3ao_u6ew8q8s63Ism1t1kb9eR1Z59vdVCRI-KO_ymRK4J-dtFIFAneei3VquQ2xD79azfiA_ODBqvIfUj-1K8K1Y9J-TkOnBTOhKNbJ6D9d6C94KvI629_1ZlsmTyxE89Um9clYzU9sVM2tyPjZTk2kpOhLEtank7DWBd1IRrW5IzLTLeU0JLUtMgrQvPieBKk4UUjynqsCpYLKIhauDbHlDypd7ZlTpuXpCiqzHChjN9ijlKrbnuQAaUp9dZ2iysRJw8FMdoH_w4TdDCqHa7Xwa1qiloqo63yh0V7r-108EEe7pI9FH_I_YumGD2f1K_xhdx4t1skWj26dXnPLR60s1lcTfv7qXsX4bWl_wYAAP__AYHNag">