[clang] [clang] Deduce _BitInt(N) template parameter as size_t (PR #195534)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 05:12:55 PDT 2026


================
@@ -2511,11 +2521,13 @@ static TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch(
         if (!NTTP)
           return TemplateDeductionResult::Success;
 
-        llvm::APSInt ArgSize(S.Context.getTypeSize(S.Context.IntTy), false);
+        // Deduce the size parameter of _BitInt as std::size_t
+        QualType T = S.Context.getSizeType();
+        llvm::APSInt ArgSize(S.Context.getTypeSize(T), false);
----------------
AaronBallman wrote:

I think we should be dropping the `false` now, right? This is an unsigned `APSInt` because we're using `size_t` (before it was signed because we were using `int`). (I don't think there's a way to test this because we don't let you make a `_BitInt` wide enough to trigger the concern.)


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


More information about the cfe-commits mailing list