================ @@ -2583,11 +2580,27 @@ struct ConvertConstructorToDeductionGuideTransform { // -- The types of the function parameters are those of the constructor. for (auto *OldParam : TL.getParams()) { - ParmVarDecl *NewParam = - transformFunctionTypeParam(OldParam, Args, MaterializedTypedefs); - if (NestedPattern && NewParam) + ParmVarDecl *NewParam = OldParam; + // Given + // template <class T> struct C { + // template <class U> struct D { + // template <class V> D(U, V); + // }; + // }; + // First, transform all the references to template parameters that are + // defined outside of the surrounding class template. That is T in the + // above example. + if (NestedPattern) { NewParam = transformFunctionTypeParam(NewParam, OuterInstantiationArgs, MaterializedTypedefs); + if (!NewParam) + return QualType(); + } + // Then, transform all the references to template parameters that are + // defined at the class template and the constructor. In this example, + // they're U and V, respectively. + NewParam = + transformFunctionTypeParam(NewParam, Args, MaterializedTypedefs); ---------------- zyn0217 wrote:
@antangelo : thanks for the explanation. I was considering if we can reuse the `transformTemplateTypeParam` stuff instead of a `TemplateDeclInstantiator` (we can make the constraint evaluation opt-in in that function; I presumed this would behave like what `setEvaluateConstraints(false)` does.), but doing that doesn't look like it would simplify the logic here significantly, so I hesitated to do so. The other part `Depth1Args` also prevents us from combining these substitution into one call - I think I have to go through it further. Anyhow, this shouldn't block a backport. https://github.com/llvm/llvm-project/pull/91628 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits