diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-11-15 09:17:49 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-11-15 11:16:49 +0000 |
commit | cbd0fe22a5ced9751d2450dc4fd6fe3525c2fc02 (patch) | |
tree | 704e6e0d360ad4fd2f46a137b974a2477b1d9d10 | |
parent | 7c16f7a154f91d61f902e2c9e63b00656156016f (diff) | |
download | gcc-cbd0fe22a5ced9751d2450dc4fd6fe3525c2fc02.zip gcc-cbd0fe22a5ced9751d2450dc4fd6fe3525c2fc02.tar.gz gcc-cbd0fe22a5ced9751d2450dc4fd6fe3525c2fc02.tar.bz2 |
libstdc++: std::stacktrace tweaks
Fix a typo in a string literal and make the new hash.cc test gracefully
handle missing stacktrace data (see PR 112541).
libstdc++-v3/ChangeLog:
* include/std/stacktrace (basic_stacktrace::at): Fix class name
in exception message.
* testsuite/19_diagnostics/stacktrace/hash.cc: Do not fail if
current() returns a non-empty stacktrace.
-rw-r--r-- | libstdc++-v3/include/std/stacktrace | 2 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace index 9a0d0b1..9d5f639 100644 --- a/libstdc++-v3/include/std/stacktrace +++ b/libstdc++-v3/include/std/stacktrace @@ -425,7 +425,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION at(size_type __n) const { if (__n >= size()) - __throw_out_of_range("basic_stack_trace::at: bad frame number"); + __throw_out_of_range("basic_stacktrace::at: bad frame number"); return begin()[__n]; } diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc index 88831ef..2170509 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc @@ -12,9 +12,10 @@ test_hash() using Alloc = __gnu_test::uneq_allocator<std::stacktrace_entry>; using S = std::basic_stacktrace<Alloc>; S s; + S cur = S::current(); std::size_t h = std::hash<S>()(s); - std::size_t h2 = std::hash<S>()(S::current()); - VERIFY( h != h2 ); + std::size_t h2 = std::hash<S>()(cur); + VERIFY( cur.empty() == (h == h2) ); } int main() |