:
struct A { };
struct Y { ~Y() noexcept(false) { throw 0; } };
A f() {
try {
A a;
Y y;
A b;
return {};
} catch (...) {
}
return {};
}
At #1, the returned object of type
A is constructed
. Next, the local variable
y is destroyed,
causing stack unwinding,
resulting in the destruction of the returned object,
followed by the destruction of the local variable
a. Finally, the returned object is constructed again at #2
. —
end example