This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/85222] [7/8 Regression] ABI breakage of __throw_ios_failure by r244498
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Apr 2018 11:39:51 +0000
- Subject: [Bug libstdc++/85222] [7/8 Regression] ABI breakage of __throw_ios_failure by r244498
- Auto-submitted: auto-generated
- References: <bug-85222-4@http.gcc.gnu.org/bugzilla/>
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.