According to cppreference
The catch (...) handler matches exceptions of any type. [...] This handler may be used to ensure that no uncaught exceptions can possibly escape from a function that offers nothrow exception guarantee.
However, given the following program:
struct throwing_dtor_t {
~throwing_dtor_t() noexcept(false) { throw 123; }
};
int main() {
try {
try {
throw throwing_dtor_t{};
} catch (...) {
}
} catch (int i) {
return i;
}
return 0;
}
Returns 123. Hence we can see that an exception has escaped the (...) handler.
Does this program has undefined behavior ? (I couldn't see anything in the standard saying so)
...