[Bug c++/58796] throw nullptr not caught by catch(type*)

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 15 19:00:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58796

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
With GCC 7 from svn trunk the original test case now prints:

About to 'throw nullptr' (first case)
Caught 'throw nullptr' as type 'int A::*PointerToMember'
About to 'throw nullptr' (second case)
Caught 'throw nullptr' as type 'void *'
About to 'throw nullptr' (last case)
Caught 'throw nullptr' as type 'int A::*PointerToMember'

And all the caught pointers are null.

Not all cases work though, nullptr cannot be caught as a pointer to member
function, and fixing that is difficult, so I'm keeping this open.


More information about the Gcc-bugs mailing list