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, c++11, c++14 |
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 | // template <class... Args> |
18 | // iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); |
19 | // template <class... Args> |
20 | // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); |
21 | // template <class M> |
22 | |
23 | // Validate whether the operation properly guards against ADL-hijacking operator& |
24 | |
25 | #include <unordered_map> |
26 | |
27 | #include "test_macros.h" |
28 | #include "operator_hijacker.h" |
29 | |
30 | void test() { |
31 | std::unordered_map<operator_hijacker, operator_hijacker> m; |
32 | { |
33 | const operator_hijacker k; |
34 | m.try_emplace(m.cend(), k); |
35 | } |
36 | { |
37 | operator_hijacker k; |
38 | m.try_emplace(m.cend(), std::move(k)); |
39 | } |
40 | } |
41 | |