<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54828>54828</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy: useless warning in for loop over characters
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rillig
      </td>
    </tr>
</table>

<pre>
    ~~~c
void demo(void) {
        for (char a = 'a'; a <= 'z'; a++) {
        }
}
~~~

> Clang-Tidy: Loop variable has narrower type 'char' than iteration's upper bound 'int'

The type of the integer constant expression `'z'` is completely irrelevant, the only thing that should matter for this kind of linter is its actual value.

If there were a warning that `'z'` might be the maximum value for the iteration type, thus leading to an endless loop, that would be fine but the warning would have to be worded differently then, to avoid confusion.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxVUttu2zAM_Rr5hWjg-BLHD35omxYYsMf-AG3RtjZZMiQ5afb1o5Rk7QDZokjqnEOKvZXXTjRvtzWI_CTy57NVEiQtVhTHaIuiBdG83IIib0frgEPDjA4QRHniU4P8ifIlOV7vvj8Pnyhe0vofRzSnu_1l3JU8ctK_fINXjWZ6-lDyKspn-GntCmd0CntNMKMHg87ZCzkI15UidRTHG4QZDahADoOyhj0etnXlxN5uRsZMZUKU-Y3wY6Ybjh35PgFn0MRXBmt8QBOAPldH3jMgiEP-KPSQg_KctKyaAukrKOdI0xkjwWtCsobdYVZmisIC-NluWsKCgRVC7CsHPfxWLI3JdWR2EVUFDziEDTXXrTfafdf7I8l0BJf4Q7igM_8o_he4qGkO0FNSs-CnWrblhnhnp69mpR7clG8eNKFMoBa4o2Sk5g6A5pe4pTDVJRXD4KMyBP0WEt5DzS0645kiBmddrJPEg6bGkXWbkFpDJsExSZpCbvm4xUbvMtmVsi1bzIIKmrohTUS4T8TmKel5kCmT6onywJ7j2_E8cAPJ-WxzuptDWD1fFMU7r0lxif2On44PWp8f29Pq7C8a-PnelfcbeTbq6lgcs7lr-hGbY45F1cr6KA8SD4d2j0Mr22rfHMZMY0_ad6LmuS8MXSBBsC3qU6a6Ii-KvMrb_b5u6nLXViNV5f6QVzUN7dCLKqcFld5FHTvrpsx1SVK_TZ6DWvngv4LI0zgZokTH-LiF2brOKa3VlCXmLin_C77dQ-4">