================ @@ -12078,6 +12079,43 @@ static void DiagnoseFailedExplicitSpec(Sema &S, OverloadCandidate *Cand) { << (ES.getExpr() ? ES.getExpr()->getSourceRange() : SourceRange()); } +static void NoteImplicitDeductionGuide(Sema &S, CXXDeductionGuideDecl *DG) { + // We want to always print synthesized deduction guides for type aliases. + // They would retain the explicit bit of the corresponding constructor. + TemplateDecl *OriginTemplate = + DG->getDeclName().getCXXDeductionGuideTemplate(); + if (!DG->isImplicit() && (!OriginTemplate || !OriginTemplate->isTypeAlias())) + return; + std::string FunctionProto; + llvm::raw_string_ostream OS(FunctionProto); + FunctionTemplateDecl *Template = DG->getDescribedFunctionTemplate(); + if (!Template) { + // This also could be an instantiation. Find out the primary template. + FunctionDecl *Pattern = + DG->getTemplateInstantiationPattern(/*ForDefinition=*/false); + if (!Pattern) { + // The implicit deduction guide is built on an explicit non-template + // deduction guide. Currently, this might be the case only for type + // aliases. + // FIXME: Add a test once https://github.com/llvm/llvm-project/pull/96686 + // gets merged. + assert( + OriginTemplate->isTypeAlias() && + "Only deduction guides for type aliases can have no template Decls"); ---------------- hokein wrote:
nit: `non-template implicit deduction guides are only possible for type aliases` https://github.com/llvm/llvm-project/pull/96084 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits