https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85222
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- Seems simpler to just define: struct __dual_ios_failure { __dual_ios_failure(std::string s, error_code e) : new_(s, e), old_(s) { } ios::failure[abi:cxx11] new_; ios::failure old_; }; and make __throw_ios_failure() throw one of that type, and make the EH runtime do the necessary adjustments to make this work: __dual_ios_failure * p1; try { try { try { throw __dual_ios_failure("", {}); } catch (__dual_ios_failure& e1) { p1 = &e1; throw; } } catch (ios::failure[abi:cxx11]& e2) { assert( &e2 == &p1->new_ ); throw; } } catch (ios::failure& e3) { assert( &e3 == &p1->old_ ); } i.e. if the catch handler is one of the ios::failure types and the actual thrown exception is __dual_ios_failure then catch the member instead of the object itself. The "throw;" would re-throw the original object of type __dual_abi_failure, so the next handler would be able to perform the same checks and adjustments. This would only require magic in the EH catch routines, not a new way to declare base classes.