Skip to content
Snippets Groups Projects
Unverified Commit c45844eb authored by Jonathan Wakely's avatar Jonathan Wakely Committed by Jonathan Wakely
Browse files

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.
parent efdda203
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment