================ @@ -1205,11 +1205,12 @@ CanThrowResult Sema::canThrow(const Stmt *S) { if (DTy.isNull() || DTy->isDependentType()) { CT = CT_Dependent; } else { - CT = canCalleeThrow(*this, DE, DE->getOperatorDelete()); + 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) + if (DD && !OperatorDelete->isDestroyingOperatorDelete()) ---------------- zygoloid wrote:
Micro-optimization: looks like we could move the destroying delete check further out. There's no need to go looking for a destructor if we have a destroying delete. (`getDestructor` does a name lookup; it's not entirely trivial work.) https://github.com/llvm/llvm-project/pull/118687 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits