[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-04-20 Thread via cfe-commits
cor3ntin wrote: @antangelo @erichkeane @hokein Should we try to land this now? 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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-22 Thread Haojian Wu via cfe-commits
hokein wrote: > I like 1, but not really 2, I think we should wait for this to be reasonably > complete before merging it, particularly this close to the release. I'd > probably be ok with 2 if we wait a few weeks until after the release, so that > we can deal with the fallout with less stress

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-21 Thread via cfe-commits
@@ -2010,6 +2032,25 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-21 Thread via cfe-commits
antangelo wrote: I have split the source deduction guide tracking into #123875, and will continue working on fixing the remaining issues here to land P2582R1 for clang 21. https://github.com/llvm/llvm-project/pull/98788 ___ cfe-commits mailing list c

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-17 Thread Erich Keane via cfe-commits
erichkeane wrote: > Both 1 and 2 seems like good options @hokein @erichkeane (especially 1 is > probably something we should try to do) I like 1, but not really 2, I think we should wait for this to be reasonably complete before merging it, particularly this close to the release. I'd probabl

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-17 Thread via cfe-commits
cor3ntin wrote: Both 1 and 2 seems like good options @hokein @erichkeane (especially 1 is probably something we should try to do) https://github.com/llvm/llvm-project/pull/98788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-16 Thread via cfe-commits
antangelo wrote: I'm still working on addressing the remaining comments, primarily the one from Erich about insufficient handling of nested templates. There are some issues when the derived class is in a nested template, and the base specifier depends on the outer template arguments, where the

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2025-01-16 Thread via cfe-commits
cor3ntin wrote: @antangelo @hokein What's the status here? If this is not merged by next week it won't make clang 20 (and there are unaddressed comments) Thanks! https://github.com/llvm/llvm-project/pull/98788 ___ cfe-commits mailing list cfe-commits

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-26 Thread via cfe-commits
@@ -10615,6 +10615,40 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
@@ -2010,6 +2032,25 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
@@ -10615,6 +10615,40 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited 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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
@@ -942,34 +946,145 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C`

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
@@ -942,34 +946,145 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C`

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: I don't think I'm needed on this review again, but did a pass through and had some comments/suggestions. Nothing binding, so I'll let others discuss this/accept this. https://github.com/llvm/llvm-project/pull/98788 _

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
@@ -2246,18 +2246,21 @@ CXXDeductionGuideDecl *CXXDeductionGuideDecl::Create( ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstr

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
@@ -1960,24 +1960,44 @@ class ExplicitSpecifier { class CXXDeductionGuideDecl : public FunctionDecl { void anchor() override; +public: + // Represents the relationship between this deduction guide and the + // deduction guide that it was generated from (or lack thereof). +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-25 Thread Erich Keane via cfe-commits
@@ -2010,6 +2032,25 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-21 Thread via cfe-commits
@@ -2010,6 +2031,25 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-21 Thread via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -11757,6 +11791,42 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } +// Errors in deduction guides from inherited constructors +// will manifest as substitution failures in the return type +// partial specializ

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -1173,25 +1276,52 @@ void DeclareImplicitDeductionGuidesForTypeAlias( NewParam->setScopeInfo(0, I); FPTL.setParam(I, NewParam); } - auto *Transformed = cast(buildDeductionGuide( - SemaRef, AliasTemplate, /*TemplateParams=*/nullptr, + +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -942,34 +946,145 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C`

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -10615,6 +10615,40 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -1203,10 +1333,291 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -1203,10 +1333,291 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -11757,6 +11791,42 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } +// Errors in deduction guides from inherited constructors +// will manifest as substitution failures in the return type +// partial specializ

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-20 Thread via cfe-commits
@@ -936,19 +940,21 @@ Expr *buildIsDeducibleConstraint(Sema &SemaRef, Context.DeclarationNames.getCXXDeductionGuideName(AliasTemplate)); }; + TemplateDecl *TD = DeducingTemplate ? DeducingTemplate : AliasTemplate; + SmallVector IsDeducibleTypeTraitArgs = {

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -1173,25 +1276,52 @@ void DeclareImplicitDeductionGuidesForTypeAlias( NewParam->setScopeInfo(0, I); FPTL.setParam(I, NewParam); } - auto *Transformed = cast(buildDeductionGuide( - SemaRef, AliasTemplate, /*TemplateParams=*/nullptr, + +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-06 Thread via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-06 Thread Matheus Izvekov via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-05 Thread Matheus Izvekov via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-11-05 Thread Matheus Izvekov via cfe-commits
@@ -11757,6 +11791,42 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } +// Errors in deduction guides from inherited constructors +// will manifest as substitution failures in the return type +// partial specializ

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-31 Thread Aaron Ballman via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-31 Thread Aaron Ballman via cfe-commits
@@ -1203,10 +1333,291 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-31 Thread Aaron Ballman via cfe-commits
@@ -10615,6 +10615,40 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-31 Thread Aaron Ballman via cfe-commits
@@ -2010,6 +2031,25 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-31 Thread Aaron Ballman via cfe-commits
@@ -11757,6 +11791,42 @@ static void DiagnoseBadDeduction(Sema &S, NamedDecl *Found, Decl *Templated, return; } +// Errors in deduction guides from inherited constructors +// will manifest as substitution failures in the return type +// partial specializ

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-31 Thread Aaron Ballman via cfe-commits
@@ -1203,10 +1333,291 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-31 Thread Aaron Ballman via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-29 Thread via cfe-commits
https://github.com/antangelo edited 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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-29 Thread via cfe-commits
@@ -0,0 +1,316 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s + +namespace test1 { + template struct Base { +template requires true +Base(T); + }; + + template struct InheritsCtors : public Base { +using Base::Base; + }; + + InheritsCtors inheritsCtors

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-29 Thread via cfe-commits
@@ -1203,10 +1333,291 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-29 Thread via cfe-commits
@@ -2010,6 +2031,25 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-29 Thread via cfe-commits
@@ -0,0 +1,316 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s + +namespace test1 { + template struct Base { +template requires true +Base(T); + }; + + template struct InheritsCtors : public Base { +using Base::Base; + }; + + InheritsCtors inheritsCtors

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-29 Thread via cfe-commits
@@ -1203,10 +1333,291 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-29 Thread Haojian Wu via cfe-commits
@@ -1960,24 +1960,38 @@ class ExplicitSpecifier { class CXXDeductionGuideDecl : public FunctionDecl { void anchor() override; +public: + enum class SourceKind { hokein wrote: @cor3ntin, if you have any ideas for a better name, could you suggest one? I thi

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-28 Thread Haojian Wu via cfe-commits
hokein wrote: > Thanks for the reviews! > > > ``` > > * can you give a description if what needs to be done in subsequent PRs? > > (maybe cxx_status.html should say "partial" > > ``` > > The remaining tasks are: > > * Supporting dependent using-declarators such as `using Derived::Base::Base`

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -58,7 +58,7 @@ inline InheritableAttr *getDLLAttr(Decl *D) { } /// Retrieve the depth and index of a template parameter. -inline std::pair getDepthAndIndex(NamedDecl *ND) { +inline std::pair getDepthAndIndex(const NamedDecl *ND) { antangelo wrote: Done, se

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -58,7 +58,7 @@ inline InheritableAttr *getDLLAttr(Decl *D) { } /// Retrieve the depth and index of a template parameter. -inline std::pair getDepthAndIndex(NamedDecl *ND) { +inline std::pair getDepthAndIndex(const NamedDecl *ND) { antangelo wrote: I'll spl

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
antangelo wrote: Thanks for the reviews! > * can you give a description if what needs to be done in subsequent PRs? > (maybe cxx_status.html should say "partial" The remaining tasks are: - Supporting dependent using-declarators such as `using Derived::Base::Base`. These are somewhat annoy

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -1398,5 +1807,30 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, ->getTemplatedDecl()) ->setDeductionCandidateKind(DeductionCandidate::Copy); + CXXRecordDecl *TemplatedDecl = Pattern->getTemplatedDecl(); + if (getLangOpts().CPlusPlus2

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -899,7 +902,8 @@ Expr *buildIsDeducibleConstraint(Sema &SemaRef, return TypeTraitExpr::Create( Context, Context.getLogicalOperationType(), AliasTemplate->getLocation(), TypeTrait::BTT_IsDeducible, IsDeducibleTypeTraitArgs, - AliasTemplate->getLocation(), /

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -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 antangelo wro

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -10616,6 +10616,43 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -10616,6 +10616,43 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-27 Thread via cfe-commits
@@ -1960,24 +1960,38 @@ class ExplicitSpecifier { class CXXDeductionGuideDecl : public FunctionDecl { void anchor() override; +public: + enum class SourceKind { antangelo wrote: Done, renamed to `SourceDeductionGuideKind` to align with the class member and

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-22 Thread Haojian Wu via cfe-commits
@@ -1107,8 +1172,32 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, Sema::CodeSynthesisContext::BuildingDeductionGuides)) { auto *GG = cast(FPrime); -Expr *IsDeducible = buildIsDeducibleConstraint( -SemaRef, AliasTemplate, FPrime->getReturnType(), F

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein approved this pull request. Thanks! It looks good from my side. Please address the comments from the other reviewers and wait a bit before landing, in case they have additional feedback. https://github.com/llvm/llvm-project/pull/98788 __

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-22 Thread Haojian Wu via cfe-commits
https://github.com/hokein edited 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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-22 Thread Haojian Wu via cfe-commits
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -11723,6 +11764,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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -10616,6 +10616,43 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1398,5 +1807,30 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, ->getTemplatedDecl()) ->setDeductionCandidateKind(DeductionCandidate::Copy); + CXXRecordDecl *TemplatedDecl = Pattern->getTemplatedDecl(); + if (getLangOpts().CPlusPlus2

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -58,7 +58,7 @@ inline InheritableAttr *getDLLAttr(Decl *D) { } /// Retrieve the depth and index of a template parameter. -inline std::pair getDepthAndIndex(NamedDecl *ND) { +inline std::pair getDepthAndIndex(const NamedDecl *ND) { cor3ntin wrote: This coul

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -899,7 +902,8 @@ Expr *buildIsDeducibleConstraint(Sema &SemaRef, return TypeTraitExpr::Create( Context, Context.getLogicalOperationType(), AliasTemplate->getLocation(), TypeTrait::BTT_IsDeducible, IsDeducibleTypeTraitArgs, - AliasTemplate->getLocation(), /

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -10616,6 +10616,43 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -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 cor3ntin wrot

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
https://github.com/cor3ntin commented: I think that this looks generally good A few comments - can you give a description if what needs to be done in subsequent PRs? (maybe cxx_status.html should say "partial" - can you add a release notes - can you add PCH or module tests for the changes t

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -931,12 +935,73 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
https://github.com/cor3ntin edited 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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1960,24 +1960,38 @@ class ExplicitSpecifier { class CXXDeductionGuideDecl : public FunctionDecl { void anchor() override; +public: + enum class SourceKind { cor3ntin wrote: Can we get a better name / comment for this enum? https://github.com/llvm/llvm

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1107,8 +1172,32 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef, Sema::CodeSynthesisContext::BuildingDeductionGuides)) { auto *GG = cast(FPrime); -Expr *IsDeducible = buildIsDeducibleConstraint( -SemaRef, AliasTemplate, FPrime->getReturnType(), F

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
https://github.com/antangelo edited 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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -634,7 +634,7 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. -SmallVector TemplateParamsReferencedInTemplateArgumentList( +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1216,10 +1328,280 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -944,12 +950,72 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1216,10 +1328,280 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -1186,17 +1281,34 @@ void DeclareImplicitDeductionGuidesForTypeAlias( NewParam->setScopeInfo(0, I); FPTL.setParam(I, NewParam); } - auto *Transformed = cast(buildDeductionGuide( - SemaRef, AliasTemplate, /*TemplateParams=*/nullptr, + +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -944,12 +950,72 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + // Class template for which we are declaring deduction guides + // This is `C` i

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -11723,6 +11764,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

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -10581,6 +10581,47 @@ bool clang::isBetterOverloadCandidate( auto *Guide1 = dyn_cast_or_null(Cand1.Function); auto *Guide2 = dyn_cast_or_null(Cand2.Function); if (Guide1 && Guide2) { + // -- F1 and F2 are generated from class template argument deduction +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -2007,6 +2022,21 @@ class CXXDeductionGuideDecl : public FunctionDecl { /// this is an implicit deduction guide. CXXConstructorDecl *getCorrespondingConstructor() const { return Ctor; } + /// Get the deduction guide from which this deduction guide was generated, + ///

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-10-21 Thread via cfe-commits
@@ -2211,17 +2211,20 @@ CXXDeductionGuideDecl *CXXDeductionGuideDecl::Create( ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstr

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-30 Thread Haojian Wu via cfe-commits
@@ -944,12 +950,67 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { return {Template, AliasRhsTemplateArgs}; } +struct InheritedConstructorDeductionInfo { + TemplateDecl *DerivedClassTemplate; hokein wrote: Thanks, it is

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-30 Thread Haojian Wu via cfe-commits
https://github.com/hokein commented: Sorry for the late response, I missed this earlier (it looks generally good). https://github.com/llvm/llvm-project/pull/98788 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-30 Thread Haojian Wu via cfe-commits
@@ -634,7 +634,7 @@ struct ConvertConstructorToDeductionGuideTransform { // Find all template parameters that appear in the given DeducedArgs. // Return the indices of the template parameters in the TemplateParams. -SmallVector TemplateParamsReferencedInTemplateArgumentList( +

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-30 Thread Haojian Wu via cfe-commits
@@ -1216,10 +1308,225 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

[clang] [clang] Implement P2582R1: CTAD from inherited constructors (PR #98788)

2024-09-30 Thread Haojian Wu via cfe-commits
@@ -1216,10 +1328,280 @@ void DeclareImplicitDeductionGuidesForTypeAlias( ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) continue; -BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); +BuildDeductionGuideForTypeAlias(Sema

  1   2   >