Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / unord / unord.map / iterator.operators.addressof.compile.pass.cpp
blob856b78293a1077edf90f8ff0d7f5a234c9a16f2f
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 //===----------------------------------------------------------------------===//
9 // <unordered_map>
11 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
12 // class Alloc = allocator<pair<const Key, T>>>
13 // class unordered_map
15 // Validate the constructors of the (const)(_local)_iterator classes to be
16 // properly guarded against ADL-hijacking operator&.
18 #include <unordered_map>
20 #include "test_macros.h"
21 #include "operator_hijacker.h"
23 template <class ToIterator, class FromIterator>
24 void test() {
25 FromIterator from;
26 ToIterator copy(from);
27 copy = from;
29 ToIterator move(std::move(from));
30 from = FromIterator();
31 move = std::move(from);
34 void test() {
36 using I = std::unordered_map<operator_hijacker, operator_hijacker>::iterator;
37 using CI = std::unordered_map<operator_hijacker, operator_hijacker>::const_iterator;
38 test<I, I>();
39 test<CI, I>();
40 test<CI, CI>();
43 using IL = std::unordered_map<operator_hijacker, operator_hijacker>::local_iterator;
44 using CIL = std::unordered_map<operator_hijacker, operator_hijacker>::const_local_iterator;
45 test<IL, IL>();
46 test<CIL, IL>();
47 test<CIL, CIL>();