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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] performance-unnecessary-value-param provide invalid hint for class with deleted move constructor
        </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>
          PiotrZSL
      </td>
    </tr>
</table>

<pre>
    Example:
```
#include <optional>

struct Some
{
    Some();
    Some(const Some&);
    Some(Some&&) = delete;

};

struct Other
{
 Other(std::optional<Some> some)
      : some(std::move(some))
 {
    }
    std::optional<Some> some;
};
```

Produces:

- <source>:13:31: warning: the parameter 'some' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
- <source>:14:14: warning: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg]

But when removing std::move:
- <source>:14:14: warning: parameter 'some' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]

In such case, check suggest developer to add std::move, but when actually moving it, other check says that's not valid.
For classes with deleted move constructor check should not suggest to use std::move.

Bug looks to be in:
- utils::type_traits::hasNonTrivialMoveConstructor
- utils::type_traits::hasNonTrivialMoveAssignment
as those functions do not check if constructor is deleted.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVctu6zYQ_Rp6M7AhkZEdL7Rw7GugQB8XuF11U1DkSGJDkQIfSv33BSnFTpybvgBjLI3mcc6cEcW9V51BrEn1RKrTisfQW1d_VTa43779uGqsvNRf_uTDqJGwAylOpDiQbbH85lvKlBE6SgTCjnYMyhquCfuyPM7WBxdFgG92wMW9e5ovAGB200dC94R9dAtr_JJKt5_EXJ-mACDsBBI1BrzGvnY93XkWYL-EHt09stlJH32QiTw73Mgdc0P2BXxuvL8BAiDssLhvmYOd8v0SfU14N4aE7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