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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 19 06:37:20 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) {
+    llvm::SmallVector<char, 16> Str;
+    Size.toString(Str);
----------------
erichkeane wrote:

Why the separately formatting?  ADT/APInt.h already ahs an operator <<, so we should be able to just `<< Size`.

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


More information about the cfe-commits mailing list