================ @@ -11758,6 +11795,40 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } + // Errors in deduction guides from inherited constructors + // will present as substitution failures in the mapping + // partial specialization, so we show a generic diagnostic + // in this case. + if (auto *DG = dyn_cast<CXXDeductionGuideDecl>(Templated); + DG && DG->getSourceKind() == + CXXDeductionGuideDecl::SourceKind::InheritedConstructor) { + CXXDeductionGuideDecl *Source = DG->getSourceDeductionGuide(); + assert(Source && + "Inherited constructor deduction guides must have a source"); + QualType DeducedRecordType( + cast<ClassTemplateDecl>(DG->getDeducedTemplate()) + ->getTemplatedDecl() + ->getTypeForDecl(), + 0); + QualType InheritedRecordType( + cast<ClassTemplateDecl>(Source->getDeducedTemplate()) + ->getTemplatedDecl() + ->getTypeForDecl(), + 0); + S.Diag(Templated->getLocation(), + diag::note_ovl_candidate_inherited_constructor_deduction_failure) + << DeducedRecordType << InheritedRecordType << TemplateArgString; + + CXXConstructorDecl *Ctor = DG->getCorrespondingConstructor(); + if (Ctor && Ctor->getBeginLoc().isValid()) ---------------- antangelo wrote:
I don't recall why I added that initially, I believe there was an example that triggered this but it no longer seems to be necessary and I can't think of conditions that would trigger it. I have removed that check accordingly. https://github.com/llvm/llvm-project/pull/98788 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits