<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120350>120350</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang][enum_overflow]Clang incorrectly thinks that enumerators of enum does not fit in the largest integer type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zhaojiangkun-1
</td>
</tr>
</table>
<pre>
Test case:
```
enum E {
e1 = 0xffffffffffffffff,
e2, e3
} e = e3;
#define SA(I,X) int a##I[(X)? 1 : -1]
SA(1, sizeof(E) == sizeof(__int128));
```
Backtrace:
```
warning: incremented enumerator value 18446744073709551616 is not representable in the largest integer type [-Wenum-too-large]
e2, e3
^
./ext1/int128-3.C:11:1: error: 'a1' declared as an array with a negative size
SA(1, sizeof(E) == sizeof(__int128));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./ext1/int128-3.C:9:26: note: expanded from macro 'SA'
#define SA(I,X) int a##I[(X)? 1 : -1]
^~~~~~~~~~~
1 warning and 1 error generated.
```
It can be compiled in gcc, but an error is reported in clang.
https://godbolt.org/z/4Pdxs5sEs
This problem has been fixed before, but is it not compatible with this yet?
https://github.com/llvm/llvm-project/issues/24667
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVF2PqzYQ_TWTl1EibEMIDzyQD6R9q9QrtW8rAwP4LrEj28km-9DfXg3stvf2VlupLUL5gPGZc8586BDMYIlKyPaQHVf6Gkfny7dRu69G2-Hlatdi1bjuUX6hELHVgUBVkFSwTd7vpCJ7PeMJId9DUiGSQFBHTO79Xy6QhyVAgjwgKYbJj0hzOClQfJ5vqTrqjSX8uQK5ewJ5-BVkgcZG1CAVSPXEhOWOH4OqkTNWuBaQHReI-aDgNMG8ketB7k4MAerIyf54-PxsbBRyxzgM9cHgG3V73b5Er9u_Ef6qvTV24NzGtp7OZCN1yH6Q19F5vOnpSih2abrN0zTJVZ4UWSa2YosmoHURPV08BbJRNxOhsRhHwkn7gf02NtJAHuPjQgjZfv0LY6-jc-s5ZNH7naOIkJ0gqTYga7pHAbJeJK7V5gCqEoI_mDJ57zz_AJlrATLHjtpJe-pQB9QWtff6ga8mjqjR0qCjudHs3X91ODv99s_XJyIKUJXcMnfrIs1i7hdtO-qw9-6MZ916x7qYZf4_tBR-RxmSSuB78VHbDsViJg5kufDUbX7soyceH4sNYevOFzNRx9Ue2pY9bK6RHV9QTOCucD4uIe2k7fAOOMZ4CdyIsgZZD65r3BQ3zg8g6zeQdfpTdw9ZOIUl_MtoAl68ayY646gDNkQWe3OnDhvqnaeP5CagiXNDMjsdDXfjXPrIGA-KoOofCZg4XptN684g62m6fXytL959pTZy3UK4UgBZy3S75VKsulJ1hSr0ikqRqzQtZCbT1Vh2qe51W-SNSDvVZzwpgoq-yLNtK4u2W5lSJjIVUuwSJXdpuknannZ5uxUFZapJW0gTOmszbZgDu7Kas5dCJipLVpNuaArzrpNydhWk5LXny5l0cx0CpMlkQgx_QkQTp3lBLieyI2R7nsJndyPfT-4VsuOBX_EOcN5TG6cHu2ZfAsZRx2_2QUDXz3-xc7TMf2_iZ1O_uvqp_Pemvyu_lfL3AAAA__-P388p">