diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index d4525c8288c68..06b2bdc98b428 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -1207,17 +1207,15 @@ static bool runRecordDestructor(InterpState &S, CodePtr OpPC, } // Destructor of this record. - if (const CXXDestructorDecl *Dtor = R->getDestructor(); - Dtor && !Dtor->isTrivial()) { - const Function *DtorFunc = S.getContext().getOrCreateFunction(Dtor); - if (!DtorFunc) - return false; + const CXXDestructorDecl *Dtor = R->getDestructor(); + assert(Dtor); + assert(!Dtor->isTrivial()); + const Function *DtorFunc = S.getContext().getOrCreateFunction(Dtor); + if (!DtorFunc) + return false; - S.Stk.push(BasePtr); - if (!Call(S, OpPC, DtorFunc, 0)) - return false; - } - return true; + S.Stk.push(BasePtr); + return Call(S, OpPC, DtorFunc, 0); } static bool RunDestructors(InterpState &S, CodePtr OpPC, const Block *B) { @@ -1229,6 +1227,9 @@ static bool RunDestructors(InterpState &S, CodePtr OpPC, const Block *B) { assert(Desc->isRecord() || Desc->isCompositeArray()); + if (Desc->hasTrivialDtor()) + return true; + if (Desc->isCompositeArray()) { unsigned N = Desc->getNumElems(); if (N == 0)