[clang] [clang][Sema] Avoid guessing unexpanded packs' size in getFullyPackExpandedSize (PR #87768)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 5 04:17:26 PDT 2024
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/87768
None
>From eb6c961896646a62f334284093994160d8c0e38e Mon Sep 17 00:00:00 2001
From: Younan Zhang <zyn7109 at gmail.com>
Date: Fri, 5 Apr 2024 19:12:28 +0800
Subject: [PATCH] [clang][Sema] Avoid guessing unexpanded packs' size in
getFullyPackExpandedSize
---
clang/lib/Sema/SemaTemplateVariadic.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp
index 903fbfd18e779c..f26771c64074b3 100644
--- a/clang/lib/Sema/SemaTemplateVariadic.cpp
+++ b/clang/lib/Sema/SemaTemplateVariadic.cpp
@@ -1243,7 +1243,10 @@ std::optional<unsigned> Sema::getFullyPackExpandedSize(TemplateArgument Arg) {
// expanded this pack expansion into the enclosing pack if we could.
if (Elem.isPackExpansion())
return std::nullopt;
+ if (Elem.containsUnexpandedParameterPack())
+ return std::nullopt;
}
+ // llvm::errs() << "Optimization takes effect: " << Pack.pack_size() << "\n";
return Pack.pack_size();
}
More information about the cfe-commits
mailing list