[Bug libstdc++/103630] [9/10/11/12 Regression] std::make_exception_ptr<T&>(t) is ill-formed

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 9 23:29:35 GMT 2021


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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:a1ca039fc0fe934ef36c25d8284e6e116bcaffa7

commit r12-5879-ga1ca039fc0fe934ef36c25d8284e6e116bcaffa7
Author: Jonathan Wakely <jwakely@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 (exception_ptr): Fix exception
            specifications on inline definitions.
            (make_exception_ptr): Decay the template parameter. Use typeid
            of the static type.
            * testsuite/18_support/exception_ptr/103630.cc: New test.


More information about the Gcc-bugs mailing list