| 1 | // { dg-options "-funwind-tables -lstdc++exp" } |
| 2 | // { dg-do run { target c++23 } } |
| 3 | // { dg-require-cpp-feature-test __cpp_lib_stacktrace } |
| 4 | |
| 5 | #include <stacktrace> |
| 6 | #include <testsuite_allocator.h> |
| 7 | #include <testsuite_hooks.h> |
| 8 | |
| 9 | void |
| 10 | test_hash() |
| 11 | { |
| 12 | using Alloc = __gnu_test::uneq_allocator<std::stacktrace_entry>; |
| 13 | using S = std::basic_stacktrace<Alloc>; |
| 14 | S s; |
| 15 | S cur = S::current(); |
| 16 | std::size_t h = std::hash<S>()(s); |
| 17 | std::size_t h2 = std::hash<S>()(cur); |
| 18 | VERIFY( cur.empty() == (h == h2) ); |
| 19 | } |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | test_hash(); |
| 24 | } |