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

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 20:23:43 PST 2025


================
@@ -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,
+  /// if it was generated as part of alias template deduction or from an
+  /// inherited constructor.
+  const CXXDeductionGuideDecl *getSourceDeductionGuide() const {
+    return SourceDeductionGuide.getPointer();
+  }
+
+  void setSourceDeductionGuide(CXXDeductionGuideDecl *DG) {
+    SourceDeductionGuide.setPointer(DG);
----------------
antangelo wrote:

I opted not to assert here and in `setSourceDeductionGuideKind` because it makes the `ASTReader` changes more readable (which otherwise would have to do a check on at least one of these fields before setting it on the incoming `CXXDeductionGuideDecl` node, but maybe that's preferable).

https://github.com/llvm/llvm-project/pull/98788


More information about the cfe-commits mailing list