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

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.
parent 7c16f7a1
No related branches found
No related tags found
No related merge requests found
...@@ -425,7 +425,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -425,7 +425,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
at(size_type __n) const at(size_type __n) const
{ {
if (__n >= size()) 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]; return begin()[__n];
} }
......
...@@ -12,9 +12,10 @@ test_hash() ...@@ -12,9 +12,10 @@ test_hash()
using Alloc = __gnu_test::uneq_allocator<std::stacktrace_entry>; using Alloc = __gnu_test::uneq_allocator<std::stacktrace_entry>;
using S = std::basic_stacktrace<Alloc>; using S = std::basic_stacktrace<Alloc>;
S s; S s;
S cur = S::current();
std::size_t h = std::hash<S>()(s); std::size_t h = std::hash<S>()(s);
std::size_t h2 = std::hash<S>()(S::current()); std::size_t h2 = std::hash<S>()(cur);
VERIFY( h != h2 ); VERIFY( cur.empty() == (h == h2) );
} }
int main() int main()
......
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