<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/68105>68105</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] False positive for cppcoreguidelines-missing-std-forward when forwarding into lambda
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nilssonk
      </td>
    </tr>
</table>

<pre>
    The following seemingly valid code
```
#include <iostream>
#include <utility>

template<typename F>
auto make_lambda(F&& f)
{
 return [f = std::forward<F>(f)] { f(); };
}

int main()
{
 auto g = make_lambda([] { std::cout << "hello\n"; });
 g();
}
```
results in the error
```
repro.cpp:5:22: error: forwarding reference parameter 'f' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward,-warnings-as-errors]
    5 | auto make_lambda(F&& f)
```

Encountered on
```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release:        22.04
Codename: jammy
```

```
$ clang-tidy --version
Ubuntu LLVM version 17.0.2
  Optimized build.
```
installed with the script from https://apt.llvm.org/llvm.sh .


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVFuvozYQ_jXmZQQCO-TywEMSNlKl01bqbvu6MniA2TU2sk2i9NdXXHJuOlsdhIzNfJ755vOMpffUGsSC5SeWl5EcQ2ddYUh7b83PqLLqXnzrEBqrtb2RacEj9mRafYer1KSgtgpZWrL0yLbp-i5LLsjUelQITJzJ-uBQ9kx8-cg8BtIU7i_WeQzYD1oGZOIc7gMa2SNcnjFyDBZ6-RO_a9lXSjK-vzC-ZXwLDeOH1dHutEzAYRidAZafGmCiBB8UE0cmjo11N-kUE-fZN9_Pu_MS2O40edpPS3ECtiuZOD3clq-JkgnQSzIr-F3kmWg7B31Ld1F9jvPMprZjmBRh4gyM8w61tiw_G8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