================ @@ -446,10 +450,46 @@ struct ConvertConstructorToDeductionGuideTransform { return nullptr; TypeSourceInfo *NewTInfo = TLB.getTypeSourceInfo(SemaRef.Context, NewType); + // At this point, the function parameters are already 'instantiated' in the + // current scope. Substitute into the constructor's trailing + // requires-clause, if any. + Expr *FunctionTrailingRC = nullptr; + if (Expr *RC = CD->getTrailingRequiresClause()) { + MultiLevelTemplateArgumentList Args; + Args.setKind(TemplateSubstitutionKind::Rewrite); + Args.addOuterTemplateArguments(Depth1Args); + Args.addOuterRetainedLevel(); + if (NestedPattern) + Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); + ExprResult E = SemaRef.SubstConstraintExprWithoutSatisfaction(RC, Args); + if (!E.isUsable()) + return nullptr; + FunctionTrailingRC = E.get(); + } + + // C++ [over.match.class.deduct]p1: + // If C is defined, for each constructor of C, a function template with + // the following properties: + // [...] + // - The associated constraints are the conjunction of the associated + // constraints of C and the associated constraints of the constructor, if + // any. + if (OuterRC) { + // The outer template parameters are not transformed, so their + // associated constraints don't need substitution. + if (!FunctionTrailingRC) + FunctionTrailingRC = OuterRC; + else + FunctionTrailingRC = BinaryOperator::Create( ---------------- cor3ntin wrote:
I think this would make everything way too complicated when checking subsumption etc (and afaik we do that in a few other places) https://github.com/llvm/llvm-project/pull/111143 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits