[clang] [Clang] Fixed an assertion caused by Microsoft integer literals exceeding the maximum value (PR #212743)

Ambrose Leeb via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 10:48:45 PDT 2026


================
@@ -4091,7 +4091,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
           !Context.getTargetInfo().hasInt128Type())
         PP.Diag(Tok.getLocation(), diag::err_integer_literal_too_large)
             << Literal.isUnsigned;
-      BitsNeeded = Literal.MicrosoftInteger;
+      BitsNeeded = std::max<unsigned>(BitsNeeded, Literal.MicrosoftInteger);
----------------
Sirraide wrote:

I also wonder if we should diagnose this; I know MSVC doesn't even w/ `/W4`, but I doubt truncation is ever the user intent if they’re writing a literal...

https://github.com/llvm/llvm-project/pull/212743


More information about the cfe-commits mailing list