================ @@ -377,8 +377,12 @@ struct ConvertConstructorToDeductionGuideTransform { if (NestedPattern) Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); auto [Depth, Index] = getDepthAndIndex(Param); + assert(Depth || + cast<ClassTemplateSpecializationDecl>(FTD->getDeclContext()) + ->isExplicitSpecialization()); NamedDecl *NewParam = transformTemplateParameter( - SemaRef, DC, Param, Args, Index + Depth1IndexAdjustment, Depth - 1); + SemaRef, DC, Param, Args, Index + Depth1IndexAdjustment, + Depth ? Depth - 1 : 0); ---------------- zyn0217 wrote:
Hmm interesting question. Afaict, the transform ConvertConstructorToDeductionGuideTransform only handles class templates nested no more than one level. So basically: - For one-level nested cases (e.g., https://godbolt.org/z/x94dzMaeo), the original template parameter depth is 1, so the new depth would be definitely 0, which seems correct. - For multi-level nested cases, we synthesize a CTAD guide with all templates except the last level being instantiated, effectively reducing it to the one-level scenario. So I think that, in the end the depth should always be 0. But I'm happy to use Depth instead of a literal 0 if that seems more appropriate. https://github.com/llvm/llvm-project/pull/128704 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits