================
@@ -1650,6 +1665,23 @@ namespace {
       return inherited::TransformTemplateArgument(Input, Output, Uneval);
     }
 
+    std::optional<unsigned> ComputeSizeOfPackExprWithoutSubstitution(
+        ArrayRef<TemplateArgument> PackArgs) {
+      // Don't do this when rewriting template parameters for CTAD:
+      //   1) The heuristic needs the unpacked Subst* nodes to figure out the
+      //   expanded size, but this never applies since Subst* nodes are not
+      //   created in rewrite scenarios.
+      //
+      //   2) The heuristic substitutes into the pattern with pack expansion
+      //   suppressed, which does not meet the requirements for argument
+      //   rewriting when template arguments include a non-pack matching 
against
+      //   a pack, particularly when rewriting an alias CTAD.
+      if (TemplateArgs.isRewrite())
+        return std::nullopt;
----------------
mizvekov wrote:

Yeah, I think the whole notion of the rewrite is a special case for 
substitution with dependent arguments, which don't happen in normal 
instantiation.

So if you changed that from 'isRewrite' to 'is any template argument 
dependent', this would still not trip for normal template instantiations.

But is it possible that we might see non-dependent arguments here on a rewrite, 
and can we do the normal thing in that case?

If so, this distinction would matter.

https://github.com/llvm/llvm-project/pull/132061
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to