函数尝试块在析构函数中

struct A
{
    ~A() noexcept(false) try
    {
        // destructor body 
    }
    catch (...)
    {
        // exceptions of destructor body are caught here
        // if no exception is thrown here
        // then the caught exception is re-thrown.
    }
};

请注意,虽然这是可能的,但是从析构函数中抛出需要非常小心,就像在堆栈展开期间调用的析构函数抛出异常一样,调用 std::terminate