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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] false positive on rvalue-reference parameters
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy,
            false-positive
      </td>
    </tr>

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

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

<pre>
    ```
auto f1(auto&& v) { // ok, no warning
    return v;
}

// Trigger warning: Forwarding reference parameter 'v' is never forwarded inside the function body. 
// cppcoreguidelines-missing-std-forward
template<typename T>
auto f2(T&& v) { 
    return v;
}
```

As per [P0257](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0527r1.html), `v` in `f2` shall be moved into the return value, so it is ok.

Moreover, `T&&` is a universal reference here; so, `v` is not sure to be an rvalue-reference, it may also be an lvalue-reference, in such a case, `v` should not be explicitly forwarded or moved. 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8U9GOqzgM_RrzYrUKToH2gYd2un1baR_mB1LiQu4NCUoCvf37VZjOTK_uaiUEDrLP8TmOVYymd8wtVCeozoWa0-BD-1D-l3HWzMXV60cLtXg-4qjm5PFWAu1zBFQD1bgAHRCaEwJdgC7ofwK9ofN4V8EZ14M4IiIGTnNwuIA8gThCc85vcXwWvQfT9xy-auQRLz7cVdDG9Rj4xoFdxzipoEZOHBCoWYAaNBEdLxzw9pHPGo2LRjOmgfE2uy4Z7zBr2eI3YTdNnQ_cz0azNY7jZjQxGtdvYtKbJxaIY-JxsioxyLf0mNipkfEd5F9fbhDQ_v0PK_5H84ufII7HiFNWU53-EVQ1UJ2B9kNKUwT57PV-v2_9xC53tvWhB7r8SF0JdIkdUU7oKZ-07yLQZVIThxyQKPf5LCpqQrkd0miBDnk4UIsFaoHG5fBGOY6DshavjKNfVg-TXx381KDszLk2ejQpu-5_bj8k_O0D-4XDE_lpxoofUeHszMIhKvsyxoEDgzxh9L-1E9H5hHEOjMnnXpTDsDJvvmpzgUk4qgcqGz-z7H9lOYxzN6DCTkV-JYqDn61eya6M_GuypjPJPl7ukA8fRmyx0K3UB3lQBbdls9sfmoOsZDG0tRaSpBa67na057JksauFrFntai2FLkxLgipRC1keZFXRlqSur1UjVSOFZrGDneBRGbu1dhnzaAsT48xtuaO6FoVVV7ZxXU-izirXb5LRD8hDfwOim7KRN5OPJpmF8-_qXIQ2g22ucx9hJ6yJKX7DJ5Psuu8vaNUZVyD8BEL_p-vfixeLOdj29xvamzTM123nR6BLJnt-NlPwP7hLQJdVWL6VT21LS_8GAAD__-MXaJA">