<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/111137>111137</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] False negative readability-redundant-casting for cast to underlying enum type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chrchr-github
</td>
</tr>
</table>
<pre>
~~~c++
#include <cstdint>
enum E : uint8_t { E0, E1 };
void g(uint8_t);
void f(uint8_t u, E e) {
g((uint8_t)e); // FN
g((uint8_t)u); // warning
}
~~~
https://godbolt.org/z/7Gcjrj64c
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsks-O2yAQxp9mfBk5woCDc_Ah2cS99RUqDKxNRHDEn1Tpwc9e2XG7u1UlBCPm-34wMDJGO3hjWqhPUJ8LmdM4hVaNQY2hHGwac1_0k3628zwroKdlkDOQI1BmvXJZGwT2pmLS1idgly27zsbnG14Q2BGz9an5kRDECS8E6BteKgRxBrbxHpPVOABtNiXQw9_cJ8X7hwLzikED9LBwXypEXDFfSOZFQ6Ad0A6775-5_3Xkr46fMnjrh80mzq9gnudXMKZ0j8COL_Uw6X5yaTeFAWj3C2gnvqlruO65KnTL9IEdZGHaStCGcEr4vhhbKRsu1UEqQTWvdC1Er5lsBGlqVUleF7alhPKKEF5VnPD9jvSSCib2e0JUzZkETsxNWrdz7nFbzi5sjNm0VVVVTBRO9sbFP_8c2kVV9nmIwImzMcUPX7LJrR2hnPRDmax-Qn3GTrpo0JtBJvswGIzUsrfOpmcZjM5eS59KJWOyfsD3KeASY5owe22Cey7ba0ek590UObj2n2dbu22nphvQbrnMtpT3MF2NSkC7taIItNuKerT0dwAAAP__kozR5Q">