[clang] [Clang] Clarify diagnostic notes for implicitly generated deduction guides (PR #96084)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 27 06:05:22 PDT 2024
================
@@ -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()))
----------------
hokein wrote:
nit: it's easier to read if we write it as `if (... && !(OriginTemplate && OriginTemplate->isTypeAlias()))`.
https://github.com/llvm/llvm-project/pull/96084
More information about the cfe-commits
mailing list