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

    <tr>
        <th>Summary</th>
        <td>
            [clang] False-positive warning for integer promotion [-Wimplicit-int-conversion]
        </td>
    </tr>

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

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

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

<pre>
    ```c
#include <stdint.h>

_Static_assert(__builtin_types_compatible_p(typeof(UINT8_C(1)), int), "");
_Static_assert(__builtin_types_compatible_p(typeof(UINT8_C(1)), uint8_t) == 0, "");

int foo(uint8_t b)
{
    uint8_t a = ((uint8_t)1) << b;
    return __builtin_types_compatible_p(typeof(((uint8_t)1) << b), int);
}

```
https://godbolt.org/z/s1f64449b

Code snippet gives a warning:
```
<source>:8:30: warning: implicit conversion loses integer precision: 'int' to 'uint8_t' (aka 'unsigned char') [-Wimplicit-int-conversion]
    8 |     uint8_t a = ((uint8_t)1) << b;
 |             ~   ~~~~~~~~~~~~~^~~~
```

However, this behavior is not considered an error in gcc (there is no warning):
https://godbolt.org/z/d1KjrbKdd
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVE2P2zYQ_TWjy8ALiZQs6qCD1o7RImgvbdGjQEmz1qQ0KZCUg_TQ315QtneToGiDIgL9IXLeezNvBtQh8NkStVA9Q3XM9Bpn59ufaJk5RLfMbChkg5s-tbDPb2uEvAMh2Y5mnQhBHkKc2ManGeS7dJZ3_S9RRx57HQL5CEL1_bCyiWz7-Gmh0I_usujIg6F-AaHSpnsBoX778edfVX8AoQoQzbYOyDbe_4EQ22pAPn93mZVtVH2SQpBHkEfM_0ET8o5txBfnQKg7BId0nHdQpwhEfHChTlQIQr0Fg2iKm8YB5AGHG20CeYqrt_itRfw76xfW3TKvj7f8XzsJeTfHuASQHYgTiNPZTYMz8cn5M4jTnyBOoXjZl2XZDDfowU2EwfKyUMQzXymgxo_aW7bnxPIleRoNt_qR0mDIToHsZA6y-wyBfFkMjxxxdPZKPrCzaFygkHKnM3lcPI2c9lM4iHqrqcbo0str-XVyWf-ht027TfWE46w9iHozpnre_f4Q27GNuzdBqI73FiiE-oD_r4MP5OP5K30-f6B6l76_8ijvfnAf6Uo-9SvOHHCgWV_ZeeSA1m3OBJ7I04TaInmfjiyexzHlFWfydAt99TW1vPuG7k7F-w9-eD9N2dTKqZGNzqgt6krUVSHrMpvboqxI7xtVTZUoRjVUQ100E-2F3Mtyr1TGrchFlddFXRRCVOVTrals9lJOTVMPjSqgzOmi2TwZc70k7YxDWKktykYolRk9kAnb_SPEaHTKXqSryLcJsBvWc4AyNxxieKOIHM12ad0Q1RFP2gTaLS5w5Cs9nMCXzavHILmLi2nA_mMYstWb9ivvOM7r8DS6C4hTSuP-s1u8-0BjBHHaygogTvfKrq34OwAA__9T8aIR">