[clang] [clang] assert fail when number of arguments in pack exceed implement… (PR #74220)

via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 2 19:22:36 PST 2023


https://github.com/wheatman updated https://github.com/llvm/llvm-project/pull/74220

>From 86e187f7f13c5cbb0d1afb9ebbe9c0e7022269a6 Mon Sep 17 00:00:00 2001
From: Brian Wheatman <bwheatman at gmail.com>
Date: Sat, 2 Dec 2023 22:17:24 -0500
Subject: [PATCH] [clang] assert fail when number of arguments in pack exceed
 implementation limit

---
 clang/lib/AST/ExprCXX.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index 83af7998f6833..2509a6ddadd19 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -1681,6 +1681,8 @@ SubstNonTypeTemplateParmPackExpr::SubstNonTypeTemplateParmPackExpr(
       AssociatedDecl(AssociatedDecl), Arguments(ArgPack.pack_begin()),
       NumArguments(ArgPack.pack_size()), Index(Index), NameLoc(NameLoc) {
   assert(AssociatedDecl != nullptr);
+  assert(NumArguments == ArgPack.pack_size() &&
+         "number of arguments in a pack exceeded implementation limit");
   setDependence(ExprDependence::TypeValueInstantiation |
                 ExprDependence::UnexpandedPack);
 }



More information about the cfe-commits mailing list