libstdc++: Fix std::basic_stacktrace special members [PR105031]
authorJonathan Wakely <jwakely@redhat.com>
Mon, 11 Apr 2022 16:44:14 +0000 (17:44 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 11 Apr 2022 16:59:50 +0000 (17:59 +0100)
commit73da9ec55609efa532b9ac85ac2dbe121c134e18
treea58b51c6f7dfbe3f627e9f32f98706a0ad99ea8c
parentbdb9639ee99b68a8c7541e78057e96fe6a2c62ed
libstdc++: Fix std::basic_stacktrace special members [PR105031]

The PR points out that there is a non-constant condition used for an
if-constexpr statement, but there are several other problems with the
copy, move and swap members of std::basic_stacktrace.

libstdc++-v3/ChangeLog:

PR libstdc++/105031
* include/std/stacktrace (basic_stacktrace::basic_stacktrace):
Fix allocator usage in constructors.
(basic_stacktrace::operator=(const basic_stacktrace&)): Do not
try to reallocate using const allocator.
(basic_stacktrace::operator=(basic_stacktrace&&)): Fix
if-constexpr with non-constant condition. Do not allocate new
storage if allocator propagates. Do not set _M_size if
allocation fails.
(basic_stacktrace::swap(basic_stacktrace&)): Fix typo. Add
assertion that non-propagating allocators are equal.
* testsuite/19_diagnostics/stacktrace/stacktrace.cc: New test.
libstdc++-v3/include/std/stacktrace
libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc [new file with mode: 0644]