[clang] [clang] Fix for Assertion `(T->hasSignedIntegerRepresentation() || T->isSignedFixedPointType()) && "Unexpected signed integer or fixed point type"' failed. (PR #195945)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Tue May 12 05:12:08 PDT 2026


================
@@ -17331,13 +17314,20 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
       if (!PromoteType.isNull() && !UnderlyingType->isBooleanType() &&
           PromoteType->isUnsignedIntegerType() !=
               UnderlyingType->isUnsignedIntegerType()) {
-        UnderlyingType =
-            UnderlyingType->isUnsignedIntegerType()
-                ? Context.getCorrespondingSignedType(UnderlyingType)
-                : Context.getCorrespondingUnsignedType(UnderlyingType);
-        if (Context.typesAreCompatible(PromoteType, UnderlyingType,
-                                       /*CompareUnqualified*/ true))
-          PromoteType = QualType();
+
+        // Because char16_t and char32_t have no corresponding signed type,
----------------
tahonermann wrote:

I think the relevant text from the C++ standard is [\[conv.prom\]p6](https://eel.is/c++draft/conv.prom#6).
> A prvalue of type `char8_t`, `char16_t`, `char32_t`, or `wchar_t` ([basic.fundamental]) (including a converted bit-field that was not already promoted to `int` or `unsigned int` according to the rules above) can be converted to a prvalue of the first of the following types that can represent all the values of its underlying type: `int`, `unsigned int`, `long int`, `unsigned long int`, `long long int`, `unsigned long long int`, or its underlying type.

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


More information about the cfe-commits mailing list