[clang] [clang] Fix crash when destructor definition is preceded with '=' (PR #90220)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 05:23:50 PDT 2024


================
@@ -3893,9 +3893,12 @@ namespace {
     }
 
     void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *E) {
-      if (E->getTemporary()->getDestructor()->isTrivial()) {
-        Inherited::VisitStmt(E);
-        return;
+      if (const CXXDestructorDecl *DtorDecl =
+              E->getTemporary()->getDestructor()) {
+        if (DtorDecl->isTrivial()) {
+          Inherited::VisitStmt(E);
+          return;
+        }
----------------
Sirraide wrote:

In addition to adding a comment here, thoughts about adding one to `CXXTemporary` to indicate that the destructor can be null? Because at least the comment above `CXXBindTemporaryExpr` makes it sound like that isn’t really supposed to be the case.

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


More information about the cfe-commits mailing list