[clang] [Clang] Fixed an assertion caused by Microsoft integer literals exceeding the maximum value (PR #212743)
A. Jiang via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 9 18:40:26 PDT 2026
================
@@ -20,5 +20,9 @@ static_assert(sizeof(0i64) == __SIZEOF_INT64__, "");
#endif
namespace gh212504 {
- static_assert(1234i8 == -46, "");
+ static_assert(1234i8 == -46, ""); // unsigned-error {{static assertion failed due to requirement '210i8 == -46':}}
+ static_assert(1234i8 == 210, ""); // signed-error {{static assertion failed due to requirement '-46i8 == 210':}}
+ static_assert(1234ui8 == 210, "");
+ static_assert(18446744073709551615i8, "");
+ static_assert(18446744073709551616i8 == 0, ""); // expected-error {{integer literal is too large to be represented in any integer type}}
----------------
frederick-vs-ja wrote:
I think it's better to test other suffixes. I've just verified that currently `i16`, `i32`, `ui8`, `ui16`, and `ui32` suffixes also cause crashing.
https://github.com/llvm/llvm-project/pull/212743
More information about the cfe-commits
mailing list