<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54286>54286</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Extend -Wsign-conversion for `(double)-someUnsignedValue`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jrose-signal
</td>
</tr>
</table>
<pre>
This code produces a warning:
```c
long test(unsigned num) {
return -num;
}
```
```
<source>:2:12: warning: the resulting value is always non-negative after implicit conversion [-Wsign-conversion]
return -num;
~~~~~~ ^~~~
```
But this very similar code does not, even though it's the same sort of pitfall:
```c
double test(unsigned num) {
return -num;
}
```
(Warning originally added in https://reviews.llvm.org/D52137.)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU01zmzAQ_TXisoNHEbGBA4c6tn9B25wFWoMyQvLoA9f_vgu4TZpm0ksZsaCnZfe93aV16tZ8HXSAzimEi3cqdRhAwlV6q23Pii-MHxj_ZXd8Xd26N872EDFEJqpkg-4tKrBpZKIGVu5XJ6DLY0zeQj6fFXeclYd3UT_eFk_BJd8hK45ER9D9MJs3FCEOSClCMpEAmKRJCCRKmqu8BbDO5hZ7GfWEIM8RPejxYnSnI-m2E_qgnQW23efPs4b8FWTbw-ciZpyVx3eLYr3Zf6hqsfsUiTsxpXQ3CHrURvq1F8rhzJwq-wQ4oSU_l_oBNCFlWBQHOZJxPoI7w0XHszTmHw1TLrUG_3_LViuq57Un4LzutSU-N5BKUQZtYYjxEmZ-4kTL46TxGjbGTOPG-Z6gw1Y8FOWGmGSqKVRd1DKLOhpsjj8iWgV_tQfOzsPMQlSrMvo2D27Eb3dl3-dRIIcsedP8SaDXcUjtpnMk_TSzuD9y-gtesKP6nHQICQO9bB9FtcuGBusSt21VtmpXcilqbDveFfxc8LriSmBmZIsmNDRKTAiLV1hC0DsNUqYbwYXg5Mx5UYp6Uz4QgFteSSkK3hbskeMotfldlMw3C6U29YEOjQ7xtWKZDItIXNJRfJloRnzz4l3AfD6SJlvyNwv_nzFkLvA">