================
@@ -77,11 +77,13 @@ inline std::optional<std::pair<unsigned, unsigned>>
 getDepthAndIndex(UnexpandedParameterPack UPP) {
   if (const auto *TTP = dyn_cast<const TemplateTypeParmType *>(UPP.first))
     return std::make_pair(TTP->getDepth(), TTP->getIndex());
-  if (isa<NamedDecl *>(UPP.first))
-    return getDepthAndIndex(cast<NamedDecl *>(UPP.first));
-  assert((isa<const TemplateSpecializationType *,
-              const SubstBuiltinTemplatePackType *>(UPP.first)));
-  return std::nullopt;
+  if (isa<const TemplateSpecializationType *,
+          const SubstBuiltinTemplatePackType *>(UPP.first))
+    return std::nullopt;
+  const auto *ND = cast<NamedDecl *>(UPP.first);
+  if (isa<ParmVarDecl>(ND))
+    return std::nullopt;
----------------
zyn0217 wrote:

I'm asking why a function named getDepthAndIndex should simply fail for a 
particular kind of parameter it's accepting, especially given the fact that 
there are also users out of template deduction.

If this is specific to template deduction, can you move the check into addPacks?


https://github.com/llvm/llvm-project/pull/215235
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to