[clang] [clang] diagnose invalid std::tuple_size sizes (PR #159677)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 19 08:12:04 PDT 2025


================
@@ -1222,6 +1222,16 @@ static IsTupleLike isTupleLike(Sema &S, SourceLocation Loc, QualType T,
   if (E.isInvalid())
     return IsTupleLike::Error;
 
+  if (Size < 0 || Size >= UINT_MAX) {
----------------
mizvekov wrote:

The host compiler uintmax is the right thing, because we pass this down on an UnsignedOrNone, which uses unsigned as the representation, so the implementation limit is uintmax-1.

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


More information about the cfe-commits mailing list