[clang] [Clang] Distinguish expanding-packs-in-place cases for SubstTemplateTypeParmTypes (PR #114220)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 11:00:42 PST 2024


================
@@ -3149,9 +3156,15 @@ struct ExpandPackedTypeConstraints
 
     assert(SemaRef.ArgumentPackSubstitutionIndex != -1);
 
+    TemplateArgument Arg = TemplateArgs(T->getDepth(), T->getIndex());
+
+    std::optional<unsigned> PackIndex;
+    if (Arg.getKind() == TemplateArgument::Pack)
+      PackIndex = Arg.pack_size() - 1 - SemaRef.ArgumentPackSubstitutionIndex;
----------------
shafik wrote:

Agreed, it seems like a valuable refactor to me.

When I see hand math like that it always raises my spidey senses and I look to see where else we are doing something like that.

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


More information about the cfe-commits mailing list