]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR libstdc++/51333 Define recursive_init_error constructor non-inline
authorJonathan Wakely <jwakely@redhat.com>
Wed, 31 Jul 2019 19:56:04 +0000 (20:56 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 31 Jul 2019 19:56:04 +0000 (20:56 +0100)
commit9acd8777c4a7cbf14b405fd3e83992a319ef20ab
tree6df880229edf9682fec14c2030d8c8d58973210f
parent8153c366de6a37108197fb9e66d96cf01b52f74f
PR libstdc++/51333 Define recursive_init_error constructor non-inline

The recursive_init_error class is defined in a header, with an inline
constructor, but the definition of the vtable and destructor are not
exported from the shared library. With -fkeep-inline-functions the
constructor gets emitted in user code, and requires the (non-exported)
vtable. This fails to link.

As far as I can tell, the recursive_init_error class definition was
moved into <cxxabi.h> so it could be documented with Doxygen, not for
any technical reason. But now it's there (and documented), somebody
could be relying on it, by catching that type and possibly performing
derived-to-base conversions to the std::exception base class. So the
conservative fix is to leave the class definition in the header but make
the constructor non-inline. This still allows the type to be caught and
still defines its base class.

Backport from mainline
2019-07-29  Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/51333
* libsupc++/cxxabi.h (__gnu_cxx::recursive_init_error): Do not define
constructor inline.
* libsupc++/guard_error.cc (__gnu_cxx::recursive_init_error): Define
constructor.
* testsuite/18_support/51333.cc: New test.

From-SVN: r273946
libstdc++-v3/ChangeLog
libstdc++-v3/libsupc++/cxxabi.h
libstdc++-v3/libsupc++/guard_error.cc
libstdc++-v3/testsuite/18_support/51333.cc [new file with mode: 0644]