[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
================
@@ -1072,12 +1072,25 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef,
AliasRhsTemplateArgs, TDeduceInfo, DeduceResults,
/*NumberOfArgumentsMustMatch=*/false);
+ static auto IsNonDeducedArgument = [&](const DeducedTemplateArgument &TA) {
+ // The following cases indicate the template argument is non-deducible:
+ // 1. The result is null. E.g. When it comes from a default template
+ // argument that doesn't appear in the alias declaration.
+ // 2. The template parameter is a pack and that cannot be deduced from
+ // the arguments within the alias declaration.
+ // Non-deducible template parameters will persist in the transformed
+ // deduction guide.
+ return TA.isNull() || (TA.getKind() == TemplateArgument::Pack &&
+ TA.pack_size() == 1 && TA.pack_begin()->isNull());
----------------
mizvekov wrote:
I find the special case here a bit odd.
We do have the concept of a partially deduced pack.
Why does that blow up here? Why doesn't that problem extend to wholly undeduced packs of size greater than one?
https://github.com/llvm/llvm-project/pull/132061
More information about the cfe-commits
mailing list