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

    <tr>
        <th>Summary</th>
        <td>
            Improve `performance-move-const-arg` message when no move constructor is available
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    ```
#include <string>
#include <utility>

struct S {
    S();
    S(const S&);

 std::string s;
};

extern void cb1(S);
extern void cb2(const std::string&);

void f()
{
    S s;
 cb1(std::move(s));

    std::string str;
 cb2(std::move(str));
}
```

```
<source>:17:9: warning: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg]
    cb1(std::move(s));
 ^~~~~~~~~~ ~
<source>:20:9: warning: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg]
    cb2(std::move(str));
 ^~~~~~~~~~   ~
```
https://godbolt.org/z/Ga3hM5h6K

Both cases trigger the exactly same warning but for different reasons. It would be great if the first case could point out that no move constructor is available/accessible instead. It already provides more details e.g. if you try to move a trivally-copyable object, so the check already provides different messages.

The original code has a much bigger class and it took me some reducing to actually figure out what the issue is as the issue was not being triggered in all cases (still investigating that).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVc2S4jYQfhpx6YIyMjb44AOzLKmtVE6TF2jLbVtZWaKkNiw57LOnJJiBYahkr5maAltqff39tDGGoHtLVIviRRS7GU48OF932tMJjzRrXHuuRZld_7OdyLZC5toqM7UEIv8S2Gvbi_zrs82JtdF8vu2mz8B-UgyvINYvlxUAgFchN0JWIn9YU84Gjlfl_e61JnAr8q3ItxcaEG4F691DMf1g8haOTregmqWQm9d7xI_b8r3zQ4unPNKh7irg2v5exh2va-t31NEdKd7Hk5_1AXyWyP4eTD4DY_8It95dLx6yfLqYfwlu8opibvl2uRb5thL5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