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_set>
12
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_multiset(InputIterator, InputIterator, typename see below::size_type = see below,
18// Hash = Hash(), Pred = Pred(), Allocator = Allocator())
19// -> unordered_multiset<iter-value-type<InputIterator>,
20// Hash, Pred, Allocator>;
21//
22// template<class T, class Hash = hash<T>,
23// class Pred = equal_to<T>, class Allocator = allocator<T>>
24// unordered_multiset(initializer_list<T>, typename see below::size_type = see below,
25// Hash = Hash(), Pred = Pred(), Allocator = Allocator())
26// -> unordered_multiset<T, Hash, Pred, Allocator>;
27//
28// template<class InputIterator, class Allocator>
29// unordered_multiset(InputIterator, InputIterator, typename see below::size_type, Allocator)
30// -> unordered_multiset<iter-value-type<InputIterator>,
31// hash<iter-value-type<InputIterator>>,
32// equal_to<iter-value-type<InputIterator>>,
33// Allocator>;
34//
35// template<class InputIterator, class Hash, class Allocator>
36// unordered_multiset(InputIterator, InputIterator, typename see below::size_type,
37// Hash, Allocator)
38// -> unordered_multiset<iter-value-type<InputIterator>, Hash,
39// equal_to<iter-value-type<InputIterator>>,
40// Allocator>;
41//
42// template<class T, class Allocator>
43// unordered_multiset(initializer_list<T>, typename see below::size_type, Allocator)
44// -> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>;
45//
46// template<class T, class Hash, class Allocator>
47// unordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator)
48// -> unordered_multiset<T, Hash, equal_to<T>, Allocator>;
49
50#include <functional>
51#include <unordered_set>
52
53int main(int, char**)
54{
55 {
56 // cannot deduce Key from nothing
57 std::unordered_multiset s;
58 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multiset'}}
59 }
60 {
61 // cannot deduce Key from just (Size)
62 std::unordered_multiset s(42);
63 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multiset'}}
64 }
65 {
66 // cannot deduce Key from just (Size, Hash)
67 std::unordered_multiset s(42, std::hash<int>());
68 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multiset'}}
69 }
70 {
71 // cannot deduce Key from just (Size, Hash, Pred)
72 std::unordered_multiset 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_multiset'}}
74 }
75 {
76 // cannot deduce Key from just (Size, Hash, Pred, Allocator)
77 std::unordered_multiset 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_multiset'}}
79 }
80 {
81 // cannot deduce Key from just (Allocator)
82 std::unordered_multiset s(std::allocator<int>{});
83 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multiset'}}
84 }
85 {
86 // cannot deduce Key from just (Size, Allocator)
87 std::unordered_multiset s(42, std::allocator<int>());
88 // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'unordered_multiset'}}
89 }
90 {
91 // cannot deduce Key from just (Size, Hash, Allocator)
92 std::unordered_multiset 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_multiset'}}
94 }
95
96 return 0;
97}
98

source code of libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.verify.cpp