https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85813
Bug ID: 85813 Summary: make_exception_ptr should support __cxa_init_primary_exception path even with -fno-exceptions Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- It looks like nothing in that path actually needs exception support. This would allow make_exception_ptr to produce a valid exception_ptr even in TUs that don't support exceptions. While that may not sound valuable, the exception_ptr could be handed to TUs that do support exceptions where it can be rethrown (a misnomer in this case...) and caught. Also, if my paper http://wg21.link/p1066 is accepted, that would provide full support for handling the exception without ever throwing it. And if this ticket is impossible to implement for some reason, I'd love to know that before Rapperswil ;) The nullptr return was added in response to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64241, but it looks like that was done before the __cxa_init_primary_exception path existed. When that was added in https://github.com/gcc-mirror/gcc/commit/cce8e59224e18858749a2324bce583bcfd160d6c#diff-e1b5856b8cc940de58c12ef252d63c34R188, I can't tell if it was put in the #if __cpp_exceptions block for a good reason or just by default.