[clang] [Clang] Fix various bugs in alias CTAD transform (PR #132061)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 21 06:34:36 PDT 2025
================
@@ -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:
Instead of special casing this on rewrite, can we do that whenever we have dependent template arguments?
https://github.com/llvm/llvm-project/pull/132061
More information about the cfe-commits
mailing list