| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03 |
| 10 | |
| 11 | // <unordered_map> |
| 12 | |
| 13 | // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, |
| 14 | // class Alloc = allocator<pair<const Key, T>>> |
| 15 | // class unordered_map |
| 16 | |
| 17 | // unordered_map& operator=(unordered_map&&) |
| 18 | // noexcept( |
| 19 | // allocator_type::propagate_on_container_move_assignment::value && |
| 20 | // is_nothrow_move_assignable<allocator_type>::value && |
| 21 | // is_nothrow_move_assignable<hasher>::value && |
| 22 | // is_nothrow_move_assignable<key_equal>::value); |
| 23 | |
| 24 | // Validate whether the container can be move-assigned with an ADL-hijacking operator& |
| 25 | |
| 26 | #include <unordered_map> |
| 27 | |
| 28 | #include "test_macros.h" |
| 29 | #include "operator_hijacker.h" |
| 30 | |
| 31 | void test() { |
| 32 | { |
| 33 | std::unordered_map<int, operator_hijacker> mo; |
| 34 | std::unordered_map<int, operator_hijacker> m; |
| 35 | m = std::move(mo); |
| 36 | } |
| 37 | { |
| 38 | std::unordered_map<operator_hijacker, int> mo; |
| 39 | std::unordered_map<operator_hijacker, int> m; |
| 40 | m = std::move(mo); |
| 41 | } |
| 42 | } |
| 43 | |