<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63867>63867</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang warning insists on changing format specifier from `%u` to `%u`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
johnstiles-google
</td>
</tr>
</table>
<pre>
Test case: https://godbolt.org/z/aW3Eax35r
We have code that uses `printf` to output an `enum class : unsigned int` with a `%u` format specifier:
```
enum class E : unsigned int {
A, B, C
};
void test(E e) {
printf("%u", e);
}
```
Previously (clang 16.0.0) this was benign and compiled without incident. On clang-trunk in -Wall we get an incorrect warning:
```
<source>:8:18: warning: format specifies type 'unsigned int' but the argument has type 'E' [-Wformat]
8 | printf("%u", e);
| ~~ ^
| %u
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2P4ygQ_TXlSymRjUPsHHzI53X3sFKfMa7YzBKIoOhs72F--wonO0n3zGEsCwQ8Xr165bKK0YyOqAO5A3koVOLJh-6bn1xkYykuRu9HS0Xvh4_uL4qMWkWCeosT8zVCvQVxAnEa_dB7y0sfRhCnf0Gc1Ft9VP_UMkB5gHJ7H98IJ_VOqP1AyJNiTJEiwrq8BuP4DOsS2aNPfE2MyuUTcumC2qoYMcdNbpY8oHGc4TfDE6oMBCFT3jn7cFGM8UranA2FLPKuYV0-3nn5Qnz8iRqh2d1hiIhbEHvc5WH_oGoOUO9eU3v3ZkCmyCDaIxKIzWeKR4KiBSFmpXnaz8AnU3P4pdIHy5-B3o1P0X4giFZb5Uas1styWeZoPJmINxWxJ2dGh8oNqP3laiwNs0s-MRqnzUCOl_iHw5lhwSG5v9E4XLwpa_FGONLsvXHah0Ca8aaCM278YST-WmW9jz4FTVAfod62UG-rPLxc_1qbiPxxJQTRfCqraLBPjDwRqjCmCznGST3Bx4wAuVu83flAHp5GtwjNHn_X8h_g_5_v3xER5PFJiD9hZrLPFhRDVw-beqMK6qp1u6llKTarYupW1SAaUfdykGXTSNWqtt9IRaqpZLuqy8J0ohR12VSrSsq2Wi210ESDFtSfV2tRDbAq6aKMXVr7fskdVpgYE3Xrul03hVU92Tg3sBCObjgf5lTloQhdvrPo0xhhVVoTOT5Z2LClbj9_Ro8SoXExg9A71JNyY9772k94Dv7y2nDsX1ZFCrb78nMwPKV-qf0FxCmHf0yLa_DfSDOI0yw6gjjNSf0XAAD__92oWFk">