| 1 | // { dg-do run { target c++17 xfail *-*-* } } |
| 2 | // { dg-require-debug-mode "" } |
| 3 | |
| 4 | #include <unordered_set> |
| 5 | #include <algorithm> |
| 6 | #include <testsuite_hooks.h> |
| 7 | |
| 8 | using test_type = std::unordered_set<int>; |
| 9 | |
| 10 | void |
| 11 | test01() |
| 12 | { |
| 13 | test_type c0{ 1, 2, 3, 5, 6, 7 }; |
| 14 | std::unordered_multiset<int> c1{ 1, 1, 2, 2, 3, 3, 4, 4, 5 }; |
| 15 | |
| 16 | auto it1 = c1.find(1); |
| 17 | auto it41 = c1.find(4); |
| 18 | auto it42 = it41; |
| 19 | ++it42; |
| 20 | VERIFY( *it42 == 4 ); |
| 21 | |
| 22 | c0.merge(c1); |
| 23 | |
| 24 | VERIFY( *it1 == 1 ); |
| 25 | VERIFY( c1.count(4) == 1 ); |
| 26 | VERIFY( it41 != it42 ); // Invalid iterator. |
| 27 | } |
| 28 | |
| 29 | int |
| 30 | main() |
| 31 | { |
| 32 | test01(); |
| 33 | } |