Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -2290,8 +2290,7 @@ // Now emit the destructor and recurse into base classes. if (const CXXDestructorDecl *Dtor = R->getDestructor(); Dtor && !Dtor->isTrivial()) { - const Function *DtorFunc = getFunction(Dtor); - if (DtorFunc && DtorFunc->isConstexpr()) { + if (const Function *DtorFunc = getFunction(Dtor)) { assert(DtorFunc->hasThisPointer()); assert(DtorFunc->getNumParams() == 1); if (!this->emitDupPtr(SourceInfo{})) Index: clang/test/AST/Interp/records.cpp =================================================================== --- clang/test/AST/Interp/records.cpp +++ clang/test/AST/Interp/records.cpp @@ -590,6 +590,26 @@ return i; } static_assert(test() == 1); + + struct S { + constexpr S() {} + constexpr ~S() { // expected-error {{never produces a constant expression}} \ + // ref-error {{never produces a constant expression}} + int i = 1 / 0; // expected-warning {{division by zero}} \ + // expected-note 2{{division by zero}} \ + // ref-warning {{division by zero}} \ + // ref-note 2{{division by zero}} + } + }; + constexpr int testS() { + S{}; // ref-note {{in call to '&S{}->~S()'}} + return 1; // expected-note {{in call to '&S{}->~S()'}} + // FIXME: ^ Wrong line + } + static_assert(testS() == 1); // expected-error {{not an integral constant expression}} \ + // expected-note {{in call to 'testS()'}} \ + // ref-error {{not an integral constant expression}} \ + // ref-note {{in call to 'testS()'}} } namespace BaseToDerived {