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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Check request: `bugprone-explicit-move-constructor`
        </td>
    </tr>

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

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

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

<pre>
    When making a move constructor `explicit`, code may end up invoking the class' copy constructor instead. For Example

```
#include <utility>

class expensive {
public:
    expensive() = default;
    
    expensive(const expensive& other) {
        // ...
    }
    
    explicit expensive(expensive&& other) {
        // ...
    }
};

void process(expensive e) {
    // ...
}

int main() {
    expensive e{};
 process(std::move(e));
    
    return 0;
}
```

In this case, the program is not going to invoke the move constructor, but rather, the copy constructor. Changing the function call to `process(explicit{std::move(e)})` is going to move `e`.

Obviously, if the copy constructor is deleted, then this is not an issue as the code is just going to fail to compile. Let me know if this check can be added so I can open a pull request for it.

Thanks in advance.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVMGOqzgQ_BpzaQUZEyA5cEgmL9KTVtrLSns2dgf8YmwW29nJ369syEwyO5cnWUaC7qrqcmHunOoNYkuqI6lOGQ9-sHMrrVRCLXvWWXlv_x7QwMivyvTAYbQ3BGGN83MQ3s5Aaorvk1ZCeVJTwt5AWIkw8jugkRAmUOZmU7cfEITmzhHWgLDT_QVIGeeRyxzOdoYf73ycNBJ6iKum66IHwkplhA4SgZRvwSut_J2UP5bKhA74PqFx6oZAmiOhhyl0WglSxgoA-PxO2I6wPZDyBBIvPGhPyuNa9E1tUvv8pgbrB5wTRvNoTM3sTNgZ8jx_oDWn_-Emz14InqF_Hz3uST6hh5tVEqbZCoxufwIDvsK9QK0w9KCMh5Er8_Dno_wZpzl-ED4xOS-j0eUhBiUyE7aP66uvM_owG6Cr4oX5-Zzp4acBPygHgjuMuYrxmWbbz3wE5cBYD71NubJLxjCVfE1obO2Ch5kvbi5AX-OXw9vATf-I6SUY4ZU1ILjWkYDU9MXOJfDN8dt5m1PcaxplfkhMuuLfQmqaLxP-2d2UDU7foyp1-VZYxJCo0aNcta-2rBZwA8q5gMDd2i8xfvsV3JM_F67SGMKOk9KYwx_oYUS4GvvvwhyNHlBcQXADHQKXEiU4Cz_TGzuhAQ5T0Bpm_Ceg83CJ6vw6y18DN1cHygCXN24E5plsS7kv9zzDtmjKuqC7oqLZ0G55RSvK-bahO7GVlx2_VJRVnWSNwN12n6mWUVbRglaMFlVF86askTdlgV3VXLBgZEtx5ErnWt_G3M59ljxoC1Y0tMk071C7dLMxJjQ3_cYreSeMxZtubmPXpgu9I1uqlfPuE8crr9Od-NRWneAtWbMOTspDPMgu9NNsDW4ecdjEI948R6-mWZh1O3g_uRiT9Lf1yg-hy4UdCTtH4vWxmWb7C4Un7JymcYSd14FuLfsvAAD__1Lgxh8">