[clang] [C++20] Deleting destructors can be noexcept (PR #118687)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 12:02:00 PST 2024


================
@@ -1206,15 +1206,16 @@ CanThrowResult Sema::canThrow(const Stmt *S) {
       CT = CT_Dependent;
     } else {
       const FunctionDecl *OperatorDelete = DE->getOperatorDelete();
-      CT = canCalleeThrow(*this, DE, OperatorDelete);
-      if (const RecordType *RT = DTy->getAs<RecordType>()) {
-        const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
-        const CXXDestructorDecl *DD = RD->getDestructor();
-        if (DD && !OperatorDelete->isDestroyingOperatorDelete())
+      if (!OperatorDelete->isDestroyingOperatorDelete()) {
+        CT = canCalleeThrow(*this, DE, OperatorDelete);
----------------
AaronBallman wrote:

Ah, good point! I'll add test coverage for that too.

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


More information about the cfe-commits mailing list