r/cpp • u/pavel_v • Apr 02 '26
What happens when a destructor throws
https://www.sandordargo.com/blog/2026/04/01/when-a-destructor-throws
102
Upvotes
r/cpp • u/pavel_v • Apr 02 '26
View all comments
9
u/wannaliveonmars Apr 02 '26
Yeah, it's because desctructors are called during stack unwinding so they are the only functions that can be called after an exception was thrown but before the catch block was reached.