Issue |
120350
|
Summary |
[clang][enum_overflow]Clang incorrectly thinks that enumerators of enum does not fit in the largest integer type
|
Labels |
clang
|
Assignees |
|
Reporter |
zhaojiangkun-1
|
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
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs