In x86-64 assembly, are C++ destructors implented by calling the destructor function before the function epilogue?

Viewed 73

When a function ends, the stack is de-allocated using mov rsp, rbp (leave). Any variable or object within that stack frame is now out of scope.

When an object with a destructor goes out of scope, I expected the destructor to be called during the function epilogue

https://godbolt.org/z/hr7KE6e5q

However, looking at the above disassembly, that does not seem to be the case. A similar function (_ZN3FooD1Ev) to the destructor is called before the epilogue, but it doesn't seem to be the destructor (which seems to be _ZN3FooD2Ev.

0 Answers
Related