diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-05-12 14:18:06 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-05-13 20:39:59 +0100 |
commit | c470f3ea86a28caacb9e9124307c4a03b2396288 (patch) | |
tree | 5fe55f44b217038f4ff32e08a2daf5387186ac31 /gcc | |
parent | e97e99296505e6015bc9e281364818bb89ca8a49 (diff) | |
download | gcc-c470f3ea86a28caacb9e9124307c4a03b2396288.zip gcc-c470f3ea86a28caacb9e9124307c4a03b2396288.tar.gz gcc-c470f3ea86a28caacb9e9124307c4a03b2396288.tar.bz2 |
libstdc++: Make std::rethrow_if_nested work without RTTI
This allows std::rethrow_if_nested to work with -fno-rtti by not
attempting the dynamic_cast if it requires RTTI, since that's ill-formed
with -fno-rtti. The cast will still work if a static upcast to
std::nested_exception is allowed.
Also use if-constexpr to avoid the compile-time overload resolution (and
SFINAE) and run-time dispatching for std::rethrow_if_nested and
std::throw_with_nested.
Also add better doxygen comments throughout the file.
libstdc++-v3/ChangeLog:
* libsupc++/nested_exception.h (throw_with_nested) [C++17]: Use
if-constexpr instead of tag dispatching.
(rethrow_if_nested) [C++17]: Likewise.
(rethrow_if_nested) [!__cpp_rtti]: Do not use dynamic_cast if it
would require RTTI.
* testsuite/18_support/nested_exception/rethrow_if_nested-term.cc:
New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions