[PATCH] D126194: [Concepts] Implement overload resolution for destructors (P0848)

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 06:49:34 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/lib/AST/DeclCXX.cpp:1901
+  for (auto* Decl : R) {
+    auto* DD = dyn_cast<CXXDestructorDecl>(Decl);
+    if (DD && DD->isEligibleOrSelected())
----------------
What cases happen when the lookup for a destructor name ends up not being a destructor on a RecordDecl type?  I guess I could see this happening with a pseudo-destructor, but that isn't a class type.




================
Comment at: clang/lib/Sema/SemaDecl.cpp:17841
+  if (CXXRecord && !CXXRecord->isDependentType())
+    ComputeSelectedDestructor(*this, CXXRecord);
+
----------------
How does all of this play with the 'defaulted destructor is constexpr' stuff?  We end up storing facts like that, destructor triviality/irrelevance/defaulted-and-constexpr/deleted/etc as a bit in the Decl, rather than calculating it.  Can this feature (Allowing overloading) cause those to be inaccurate?

That is, could we do something like use a requires clause to select between a trivial, irrelevant, and constexpr destructor? Do we need to make sure we update those too?  I would expect that the destructor here would need to store its OWN trivaility/relevance/constexpr/etc here, so we can then update those flags on the type once it is selected.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126194/new/

https://reviews.llvm.org/D126194



More information about the cfe-commits mailing list