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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] False positive for cppcoreguidelines-rvalue-reference-param-not-moved when parameter has [[maybe_unused]]
        </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 <tuple>
#include <utility>

void conditional_use([[maybe_unused]] int && x) {
#ifdef USE_X
    int y = std::move(x);
    std::ignore = y;
#endif
}

int main() {
 conditional_use(5);
}
```

results in the error
```
repro.cpp:4:46: error: rvalue reference parameter 'x' is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved,-warnings-as-errors]
 4 | void conditional_use([[maybe_unused]] int && x) {
```

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/eJysVE2P4zYM_TXKhbBhy46THHxIJhOgwLQFOrtFbwPZom1uZcnQh2fTX1_4Yydpmz0U2CBRYr1HPfKFlHCOWo1Ysu2Jbc8bEXxnbKlJOWf0n5vKyGv5qUNojFLmnXQLDrEn3aorjEKRhNpIZMmZJcd1LZL1vTzyjHStgkRg2ZMPg0KWPT_CgidF_npD53U0s4aW5Mlood6CQ8b3c76nXlwrfAs6OJRse2bbM5D2wHjBeAFfGT8A251uYo3EBj6_Pr_9sewBwBxwBZadwXnJsiPLjr0ZJ40pnmWnG_WDQK02Fueg6weD8Qy1pGZ92p3vy5hUekF6Sv0-qwelbe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