<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/133562>133562</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] `misc-const-correctness` false positive
</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>
tearfur
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/dbKn7dWYz
```
<source>:8:5: warning: variable 'vz' of type 'size_t' (aka 'unsigned long') can be declared 'const' [misc-const-correctness]
8 | size_t vz = static_cast<size_t>(v);
| ^
| const
```
If I change the problematic line to `auto vz = static_cast<size_t>(v);`, the warning goes away.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMUs2K4zwQfJr2pUmQW5Z_Dj54kjEM3wN87GmQZcXRrmIFSfaQPP0iJ_vDLAtrGtwU7qrqdskQzDRr3YJ4AXHM5BLPzrdRS39afDa48daeY7wG4B1QD9RPbhycjXvnJ6D-DtSPw39zNf7_5Q6sS1WyZ7EO-CG4xSsN_BV4VwPvBPAOP6SfzTyldpXeyMFqBKrWO1CF7oTxdt2AYO76PSYQqJbfZMKWebM8onXzBFQBNajkjIPGUSsrvR7TZ8rN4TEpXi4mqN0G7JTzXqs46xBAHIF1iIg1QnVIDT4Ecb0j8COGKKNR70qGmDZ5mOGvQPUK1AB_ec7jz3kQr39gz-dh6NN9WPd2wjdUZzlPGuNZ49W7wepLEkZrZo3RIZRMLtH9u62SAR02uuelcXI6oPyQt302tnxseCMz3eZVwSlvyqrIzm3BZSVyavhwIlXnUuSS1-WYl3Vdj6IQmWmJkWCcGsaLPC_2VSMrxfJCDqIpWEFQMH2Rxu6tXS8pIZkJYdFtzrkoKbNy0DZsUSNSVs7TLprxBkRAByA6SRv07uqCiWbVCRbHzLeJbDcsU4CCWRNi-EUfTbRbdn9jE8d0r7_88pLhpoI_VLLF288JN_G8DHvlLkB9knq-dlfvvmoVgfptrQDUPzdbW_oeAAD__4HM_o0">