diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-09-24 12:44:09 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2024-09-26 12:38:40 +0100 |
commit | c45844eb7dadcd48e3ce84444a45c270382f7ad1 (patch) | |
tree | c0733da48e548532b56ddda6a824372321d3d8e1 | |
parent | efdda203f52b9b55ef9acc8ad668bbd0570a8de6 (diff) | |
download | gcc-c45844eb7dadcd48e3ce84444a45c270382f7ad1.zip gcc-c45844eb7dadcd48e3ce84444a45c270382f7ad1.tar.gz gcc-c45844eb7dadcd48e3ce84444a45c270382f7ad1.tar.bz2 |
libstdc++: Fix std::basic_stracktrace to not assume allocators throw std::bad_alloc
The standard allows allocators to throw any kind of exception, not only
something that can be caught as std::bad_alloc. std::basic_stracktrace
was assuming std::bad_alloc.
libstdc++-v3/ChangeLog:
* include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate):
Do not assume allocators only throw std::bad_alloc.
-rw-r--r-- | libstdc++-v3/include/std/stacktrace | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace index de74460..58d0c2a 100644 --- a/libstdc++-v3/include/std/stacktrace +++ b/libstdc++-v3/include/std/stacktrace @@ -560,7 +560,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if constexpr (is_same_v<allocator_type, allocator<value_type>>) { // For std::allocator we use nothrow-new directly so we - // don't need to handle bad_alloc exceptions. + // don't need to handle exceptions from __alloc.allocate(n). auto __p = __detail::__get_temporary_buffer<value_type>(__n); if (__p == nullptr) [[unlikely]] return nullptr; @@ -572,7 +572,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_frames = __alloc.allocate(__n); } - __catch (const std::bad_alloc&) + __catch (...) { return nullptr; } |