Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / unord / unord.multimap / unord.multimap.cnstr / deduct.verify.cpp
blob5e8db678b6e20c69487f32f2940648709b45b0c6
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 // UNSUPPORTED: c++03, c++11, c++14
11 // <unordered_map>
13 // template<class InputIterator,
14 // class Hash = hash<iter-key-type<InputIterator>>,
15 // class Pred = equal_to<iter-key-type<InputIterator>>,
16 // class Allocator = allocator<iter-to-alloc-type<InputIterator>>>
17 // unordered_multimap(InputIterator, InputIterator, typename see below::size_type = see below,
18 // Hash = Hash(), Pred = Pred(), Allocator = Allocator())
19 // -> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash, Pred,
20 // Allocator>;
22 // template<class Key, class T, class Hash = hash<Key>,
23 // class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
24 // unordered_multimap(initializer_list<pair<Key, T>>,
25 // typename see below::size_type = see below, Hash = Hash(),
26 // Pred = Pred(), Allocator = Allocator())
27 // -> unordered_multimap<Key, T, Hash, Pred, Allocator>;
29 // template<class InputIterator, class Allocator>
30 // unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Allocator)
31 // -> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
32 // hash<iter-key-type<InputIterator>>,
33 // equal_to<iter-key-type<InputIterator>>, Allocator>;
35 // template<class InputIterator, class Allocator>
36 // unordered_multimap(InputIterator, InputIterator, Allocator)
37 // -> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
38 // hash<iter-key-type<InputIterator>>,
39 // equal_to<iter-key-type<InputIterator>>, Allocator>;
41 // template<class InputIterator, class Hash, class Allocator>
42 // unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
43 // -> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
44 // equal_to<iter-key-type<InputIterator>>, Allocator>;
46 // template<class Key, class T, class Allocator>
47 // unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type, Allocator)
48 // -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
50 // template<class Key, class T, class Allocator>
51 // unordered_multimap(initializer_list<pair<Key, T>>, Allocator)
52 // -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
54 // template<class Key, class T, class Hash, class Allocator>
55 // unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type, Hash,
56 // Allocator)
57 // -> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>;
59 #include <functional>
60 #include <unordered_map>
62 int main(int, char**)
64 using P = std::pair<const int, int>;
66 // cannot deduce Key from nothing
67 std::unordered_multimap m; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
70 // cannot deduce Key from just (Size)
71 std::unordered_multimap m(42); // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
74 // cannot deduce Key from just (Size, Hash)
75 std::unordered_multimap m(42, std::hash<int>());
76 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
79 // cannot deduce Key from just (Size, Hash, Pred)
80 std::unordered_multimap m(42, std::hash<int>(), std::equal_to<int>());
81 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
84 // cannot deduce Key from just (Size, Hash, Pred, Allocator)
85 std::unordered_multimap m(42, std::hash<int>(), std::equal_to<int>(), std::allocator<P>());
86 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
89 // cannot deduce Key from just (Allocator)
90 std::unordered_multimap m(std::allocator<P>{});
91 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
94 // cannot deduce Key from just (Size, Allocator)
95 std::unordered_multimap m(42, std::allocator<P>());
96 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
99 // cannot deduce Key from just (Size, Hash, Allocator)
100 std::unordered_multimap m(42, std::hash<int>(), std::allocator<P>());
101 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multimap'}}
104 return 0;