Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / unord / unord.set / unord.set.cnstr / deduct.verify.cpp
blobd6082810216df83565fe21c98d5ba57a6daee8b2
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_set>
13 // template<class InputIterator,
14 // class Hash = hash<iter-value-type<InputIterator>>,
15 // class Pred = equal_to<iter-value-type<InputIterator>>,
16 // class Allocator = allocator<iter-value-type<InputIterator>>>
17 // unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
18 // Hash = Hash(), Pred = Pred(), Allocator = Allocator())
19 // -> unordered_set<iter-value-type<InputIterator>,
20 // Hash, Pred, Allocator>;
22 // template<class T, class Hash = hash<T>,
23 // class Pred = equal_to<T>, class Allocator = allocator<T>>
24 // unordered_set(initializer_list<T>, typename see below::size_type = see below,
25 // Hash = Hash(), Pred = Pred(), Allocator = Allocator())
26 // -> unordered_set<T, Hash, Pred, Allocator>;
28 // template<class InputIterator, class Allocator>
29 // unordered_set(InputIterator, InputIterator, typename see below::size_type, Allocator)
30 // -> unordered_set<iter-value-type<InputIterator>,
31 // hash<iter-value-type<InputIterator>>,
32 // equal_to<iter-value-type<InputIterator>>,
33 // Allocator>;
35 // template<class InputIterator, class Hash, class Allocator>
36 // unordered_set(InputIterator, InputIterator, typename see below::size_type,
37 // Hash, Allocator)
38 // -> unordered_set<iter-value-type<InputIterator>, Hash,
39 // equal_to<iter-value-type<InputIterator>>,
40 // Allocator>;
42 // template<class T, class Allocator>
43 // unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
44 // -> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
46 // template<class T, class Hash, class Allocator>
47 // unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
48 // -> unordered_set<T, Hash, equal_to<T>, Allocator>;
50 #include <functional>
51 #include <unordered_set>
53 int main(int, char**)
56 // cannot deduce Key from nothing
57 std::unordered_set s;
58 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
61 // cannot deduce Key from just (Size)
62 std::unordered_set s(42);
63 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
66 // cannot deduce Key from just (Size, Hash)
67 std::unordered_set s(42, std::hash<int>());
68 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
71 // cannot deduce Key from just (Size, Hash, Pred)
72 std::unordered_set s(42, std::hash<int>(), std::equal_to<>());
73 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
76 // cannot deduce Key from just (Size, Hash, Pred, Allocator)
77 std::unordered_set s(42, std::hash<int>(), std::equal_to<>(), std::allocator<int>());
78 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
81 // cannot deduce Key from just (Allocator)
82 std::unordered_set s(std::allocator<int>{});
83 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
86 // cannot deduce Key from just (Size, Allocator)
87 std::unordered_set s(42, std::allocator<int>());
88 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
91 // cannot deduce Key from just (Size, Hash, Allocator)
92 std::unordered_set s(42, std::hash<short>(), std::allocator<int>());
93 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_set'}}
96 return 0;