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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 06:21:17 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);
----------------
erichkeane wrote:

yeah, we would want the unsigned size type, not signed, in order to match arrays/etc.

we MIGHT lose some diagnostics/see some tests changed (since I think we actually test for negative size somewhere?).

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


More information about the cfe-commits mailing list