1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
13 // template<class InputIterator,
14 // class Compare = less<iter-value-type<InputIterator>>,
15 // class Allocator = allocator<iter-value-type<InputIterator>>>
16 // multiset(InputIterator, InputIterator,
17 // Compare = Compare(), Allocator = Allocator())
18 // -> multiset<iter-value-type<InputIterator>, Compare, Allocator>;
19 // template<class Key, class Compare = less<Key>,
20 // class Allocator = allocator<Key>>
21 // multiset(initializer_list<Key>, Compare = Compare(), Allocator = Allocator())
22 // -> multiset<Key, Compare, Allocator>;
23 // template<class InputIterator, class Allocator>
24 // multiset(InputIterator, InputIterator, Allocator)
25 // -> multiset<iter-value-type<InputIterator>,
26 // less<iter-value-type<InputIterator>>, Allocator>;
27 // template<class Key, class Allocator>
28 // multiset(initializer_list<Key>, Allocator)
29 // -> multiset<Key, less<Key>, Allocator>;
33 #include <type_traits>
35 struct NotAnAllocator
{
36 friend bool operator<(NotAnAllocator
, NotAnAllocator
) { return false; }
39 int main(int, char **) {
41 // cannot deduce Key from nothing
43 // expected-error-re@-1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multiset'}}
46 // cannot deduce Key from just (Compare)
47 std::multiset
s(std::less
<int>{});
48 // expected-error-re@-1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multiset'}}
51 // cannot deduce Key from just (Compare, Allocator)
52 std::multiset
s(std::less
<int>{}, std::allocator
<int>{});
53 // expected-error-re@-1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multiset'}}
56 // cannot deduce Key from multiset(Allocator)
57 std::multiset
s(std::allocator
<int>{});
58 // expected-error-re@-1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multiset'}}
61 // since we have parens, not braces, this deliberately does not find the
62 // initializer_list constructor
65 // expected-error-re@-1{{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}multiset'}}