https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103630
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-9 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:93a621991615e943704ed1a957d934736bf8a3d3 commit r9-10063-g93a621991615e943704ed1a957d934736bf8a3d3 Author: Jonathan Wakely <jwak...@redhat.com> Date: Thu Dec 9 13:54:39 2021 +0000 libstdc++: Fix std::exception_ptr regressions [PR103630] This restores support for std::make_exception_ptr<E&> and for using std::exception_ptr in C++98. Because the new non-throwing implementation needs to use std::decay to handle references the original throwing implementation is used for C++98. We also need to change the typeid expression so it doesn't yield the dynamic type when the function parameter is a reference to a polymorphic type. Otherwise the new exception object could be caught by any handler matching the dynamic type, even though the actual exception object is only a copy of the base class, sliced to the static type. libstdc++-v3/ChangeLog: PR libstdc++/103630 * libsupc++/exception_ptr.h (make_exception_ptr): Decay the template parameter. Use typeid of the static type. * testsuite/18_support/exception_ptr/103630.cc: New test. (cherry picked from commit a1ca039fc0fe934ef36c25d8284e6e116bcaffa7)