[clang] [Sema] Default arguments for template parameters affect ContainsUnexpandedPacks (PR #99880)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 02:13:25 PDT 2024


================
@@ -61,27 +61,43 @@ TemplateParameterList::TemplateParameterList(const ASTContext& C,
 
     bool IsPack = P->isTemplateParameterPack();
     if (const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(P)) {
-      if (!IsPack && NTTP->getType()->containsUnexpandedParameterPack())
-        ContainsUnexpandedParameterPack = true;
+      if (!IsPack) {
+        if (NTTP->getType()->containsUnexpandedParameterPack())
+          ContainsUnexpandedParameterPack = true;
+        else if (NTTP->hasDefaultArgument() &&
+                 NTTP->getDefaultArgument()
+                     .getArgument()
+                     .containsUnexpandedParameterPack())
----------------
cor3ntin wrote:

could we have a function - or at least a lambda - that avoid the repetition of that 3 times?

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


More information about the cfe-commits mailing list