[clang] [Clang] Fix constexpr-ness on implicitly deleted destructors (PR #116359)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 05:37:31 PST 2024


================
@@ -890,6 +890,13 @@ class CXXRecordDecl : public RecordDecl {
             needsOverloadResolutionForDestructor()) &&
            "destructor should not be deleted");
     data().DefaultedDestructorIsDeleted = true;
+    // C++23 [dcl.constexpr]p3.2:
+    //  if the function is a constructor or destructor, its class does not have
+    //  any virtual base classes.
+    // C++20 [dcl.constexpr]p5:
+    //   The definition of a constexpr destructor whose function-body is
+    //   [not = delete] shall additionally satisfy...
+    data().DefaultedDestructorIsConstexpr = !data().HasVBases;
----------------
AaronBallman wrote:

Can this be `data().NumVBases == 0`?

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


More information about the cfe-commits mailing list