Skip to content

Commit c665769

Browse files
committed
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. (cherry picked from commit cbd0fe2)
1 parent b20e796 commit c665769

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

libstdc++-v3/include/std/stacktrace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
487487
at(size_type __n) const
488488
{
489489
if (__n >= size())
490-
__throw_out_of_range("basic_stack_trace::at: bad frame number");
490+
__throw_out_of_range("basic_stacktrace::at: bad frame number");
491491
return begin()[__n];
492492
}
493493

libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ test_hash()
1212
using Alloc = __gnu_test::uneq_allocator<std::stacktrace_entry>;
1313
using S = std::basic_stacktrace<Alloc>;
1414
S s;
15+
S cur = S::current();
1516
std::size_t h = std::hash<S>()(s);
16-
std::size_t h2 = std::hash<S>()(S::current());
17-
VERIFY( h != h2 );
17+
std::size_t h2 = std::hash<S>()(cur);
18+
VERIFY( cur.empty() == (h == h2) );
1819
}
1920

2021
int main()

0 commit comments

Comments
 (0)