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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy bugprone-signed-char-misuse triggers on int8_t to int cast
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    When running the following code through `clang-tidy` with `bugprone-signed-char-misuse`
```
    int8_t y = 0;
    int32_t x = y;
```
it prints
```
[warning: 'signed char' to 'int32_t' (aka 'int') conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]](javascript:;)
    7 |     int32_t x = y;
```
I think we should not print this warning when `int8_t` is used. The warning is to catch character to int conversions, but when `int8_t` is used, the user normally wants explicitly a signed integer.

In addition, I wonder actually why the check triggers on
```
    signed char y = 0;
    int32_t x = y;
```
Since here already I indicate that I want a signed char. AFAIK, `char`, `signed char`, `unsigned char` are 3 different types, and whether `char` becomes `signed char` or `unsigned char` is implementation-defined.
IMHO, the check should only trigger on `char`, i.e. only for
```
    char y = 0;
    int32_t x = y;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVF-P4yYQ_zTkZRTLwfG_Bz9sdhU1qqo-tFIfTxgmhlsCEYyT87evcLyb3Pb2pLaSpYQZmOH3hxExmsEhdqzcsfJlJUbSPnRKXIwKXodV79XU_aXRQRidM24A0ghHb62_ppX0CoF08OOggVW5tMINazJqYlUOV0NztB-Hc_AO13M3tZZahPXJxDEiq3KWv7D8Kf25ffMSAMA4ar4QTMCKF8hZsfsuVfAvBN_m3PSe-1DFEJyDcRR_mGXl7ipCQsWKJ2C8vl0P0vUYr4F8Ci6tUoDxRryKJch4zXgL0rsLhmi8Y8UuraJRGECKSDNdc43RfSh9NCFSBqzc_Yyb8iV9vPkqLiLKYM7EiqeElbd3Kmpg9TP8C1IOQNq4V7giRO1Hq8D5haeUibCQAtekO6vymw5JUBNhjKgy-FPj-zYTE0opSOoZn5CEIYVSwTs9kfFn6Ef6vGzakOw1RgzgfDgJaye4CkcR8NvZGmnITiBgIdM4wgFDtqC8gXMglDKU9ODPcICrd0kPIWm8ldPT3ERqlK9AwQwDhgjefWrDB-n-jxf_ME4iaAwIwgYUaoIDGKeMFJTekKB0W-HoDjC1zOBp_3T4NYFJ7yv5p8qX1aOp3oPfe63KQQSEApQ5HjFg0ng64yyGcCqJQRrDQ23oUfoTxn82AB9-2MBEMKezxRM6Eon5tcKjcagWZQ6__fL7m7Y32hffeWenNwnAuw8ATYbZbcvRh0_V-e-yrFRXqLZoxQq7Tc2rsiq2LV_pruStLNu22vTthueI2Bbbqi2r8lhgX2_ylel4zrd5u6nzpmw2PGv7vGm2dd1XqiyqpmbbHE_C2MzayynzYViZGEfsNnnTbouVFT3aOA9dzh9GJudpCIcunVr34xDZNrcmUrzXIUMWu_sZ-Mn8eHT32zB9e5Yi0moMttNE55imCt8zvh8M6bHPpD8xvk89l5_1OfivKInx_QwkMr5fsFw6_ncAAAD__xxC71o">