================ @@ -4008,6 +3996,38 @@ TemplateDeductionResult Sema::FinishTemplateArgumentDeduction( Owner = FunctionTemplate->getLexicalDeclContext(); FunctionDecl *FD = FunctionTemplate->getTemplatedDecl(); + // C++20 [temp.deduct.general]p5: (CWG2369) + // If the function template has associated constraints, those constraints are + // checked for satisfaction. If the constraints are not satisfied, type + // deduction fails. + // FIXME: We haven't implemented CWG2369 for lambdas yet, because we need + // to figure out how to instantiate lambda captures to the scope without + // first instantiating the lambda. + bool IsLambda = isLambdaCallOperator(FD) || isLambdaConversionOperator(FD); + if (!IsLambda && !IsIncomplete) { + if (CheckFunctionTemplateConstraints( + Info.getLocation(), + FunctionTemplate->getCanonicalDecl()->getTemplatedDecl(), + CanonicalBuilder, Info.AssociatedConstraintsSatisfaction)) + return TemplateDeductionResult::MiscellaneousDeductionFailure; + if (!Info.AssociatedConstraintsSatisfaction.IsSatisfied) { + Info.reset(Info.takeSugared(), + TemplateArgumentList::CreateCopy(Context, CanonicalBuilder)); ---------------- cor3ntin wrote:
ping @mizvekov https://github.com/llvm/llvm-project/pull/102857 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits