<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82756>82756</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Expand -Wredundant-move to detect instances where a const object is being moved
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
11happy
</td>
</tr>
</table>
<pre>
```
#include<iostream>
using namespace std;
struct T { };
T f(const T& t)
{
return std::move(t);
}
int main(){
}
```
Output GCC:
```
<source>: In function 'T f(const T&)':
<source>:7:19: warning: redundant move in return statement [-Wredundant-move]
7 | return std::move(t);
| ~~~~~~~~~^~~
<source>:7:19: note: remove 'std::move' call
Compiler returned: 0
```
Compiler Explorer: https://godbolt.org/z/s1jv3sb1a
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU0tvs0gQ_DXNpWULmsfgAwc_V3vaS6Q9D9CxJ4IZNA8n2UN--2qwP6xYkb5vhACpqqurC1o6p86auYFyB-UhkcFfjG2y7CKn6TNpTf_ZQJXer_QA6RaBcqW7IfQM-V4Z5y3LEfLjHQ5O6TNqObKbZMfofA_57g4iovM2dB5fEMQOQRwW8HZ_wVegujPaeXwBqtADbe4EschY9sHqm_YW8u1orgxUz9xFTxzudKU9jlJpoDoSFpmF8TTiP8FPweNf-31U_4kB-d6ZYDuOc-db_Fvja9CdV0YjkHgeInYl8RD7Xh2BbBNl3qXVSp_jq-U-6F5G5-bKqPRjZul5ZO0Ryt3q34W3mjMoD4-kBYLY_1FUOJ_IXs7XrwPl8evrN7618XwzPZsFEk_tBHZyGG4qezNOamB7d8aRiOnPMX8vOH5Mg7FsY8HF-8nFFnQCOp1N35rBr409A53-Azq57O2auzaTSd_k_SbfyISbTKR1VW-KgpJL03FZvhblRpSZSAtZyyKtsqJvK9lzldZZohpKqUiJ8iwrBdE6JUGylTnnFZdlXUGR8ijVsB6G6xh7J8q5wE1NoqySQbY8uHmziDS_4wwCUVw028SaVRvODop0UM67h4pXfuDm-DFJ3ePzJ0ZvsGfPnUelnZe6Y4fvF7aMEm-_nGnfZthhy3EZY1mfBDs0T6kpfwntujMj0Cl2vz9WkzVRAeg0e3ZAp3mm_wMAAP__duU6Dg">