| 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 }; |
| 14 | test_type c1{ 1, 2, 3, 4 }; |
| 15 | |
| 16 | auto it2 = c1.find(2); |
| 17 | auto it4 = c1.find(4); |
| 18 | VERIFY( *it2 == 2 ); |
| 19 | VERIFY( *it4 == 4 ); |
| 20 | |
| 21 | c0.merge(c1); |
| 22 | |
| 23 | VERIFY( *it2 == 2 ); |
| 24 | VERIFY( it2 != it4 ); // Invalid iterator. |
| 25 | } |
| 26 | |
| 27 | int |
| 28 | main() |
| 29 | { |
| 30 | test01(); |
| 31 | } |