When the last shared_ptr owning the object is destroyed, the owned object is also destroyed. But the standard doesn't specifically state that this happens in the context of exceptions
when stack unwinding is done, and a suitable catch statement is found, destructors run, this is in the standard