libstdc++-v3/testsuite/23_containers/unordered_set/insert/115285.cc
raw| 1 | // { dg-do run { target c++11 } } |
| 2 | |
| 3 | // PR libstdc++/115285 |
| 4 | |
| 5 | #include <unordered_set> |
| 6 | #include <testsuite_hooks.h> |
| 7 | |
| 8 | struct K { |
| 9 | explicit K(int) noexcept { } |
| 10 | bool operator==(const K&) const { return true; } |
| 11 | }; |
| 12 | |
| 13 | template<> struct std::hash<K> { |
| 14 | std::size_t operator()(const K&) const { return 0ul; } |
| 15 | }; |
| 16 | |
| 17 | void |
| 18 | test01() |
| 19 | { |
| 20 | int i[2]{1, 2}; |
| 21 | std::unordered_set<K> s(i, i+2); |
| 22 | VERIFY( s.size() == 1 ); |
| 23 | } |
| 24 | |
| 25 | int main() |
| 26 | { |
| 27 | test01(); |
| 28 | } |