1acd629cdSMarshall Clow //===----------------------------------------------------------------------===//
2acd629cdSMarshall Clow //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6acd629cdSMarshall Clow //
7acd629cdSMarshall Clow //===----------------------------------------------------------------------===//
8acd629cdSMarshall Clow 
9acd629cdSMarshall Clow // <queue>
10*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
11acd629cdSMarshall Clow 
12acd629cdSMarshall Clow #include <queue>
13acd629cdSMarshall Clow #include <deque>
14acd629cdSMarshall Clow #include <iterator>
15acd629cdSMarshall Clow #include <cassert>
16acd629cdSMarshall Clow #include <cstddef>
17acd629cdSMarshall Clow 
18acd629cdSMarshall Clow 
main(int,char **)192df59c50SJF Bastien int main(int, char**)
20acd629cdSMarshall Clow {
21acd629cdSMarshall Clow //  Test the explicit deduction guides
22acd629cdSMarshall Clow     {
23acd629cdSMarshall Clow //  queue(Compare, Container, const Alloc);
24acd629cdSMarshall Clow //  The '45' is not an allocator
25acd629cdSMarshall Clow     std::priority_queue pri(std::greater<int>(), std::deque<int>({1,2,3}), 45);  // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'priority_queue'}}
26acd629cdSMarshall Clow     }
27acd629cdSMarshall Clow 
28acd629cdSMarshall Clow     {
29acd629cdSMarshall Clow //  queue(const queue&, const Alloc&);
30acd629cdSMarshall Clow //  The '45' is not an allocator
31acd629cdSMarshall Clow     std::priority_queue<int> source;
32acd629cdSMarshall Clow     std::priority_queue pri(source, 45);  // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'priority_queue'}}
33acd629cdSMarshall Clow     }
34acd629cdSMarshall Clow 
35acd629cdSMarshall Clow     {
36acd629cdSMarshall Clow //  priority_queue(Iter, Iter, Comp)
37acd629cdSMarshall Clow //  int is not an iterator
38acd629cdSMarshall Clow     std::priority_queue pri(15, 17, std::greater<double>());  // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'priority_queue'}}
39acd629cdSMarshall Clow     }
40acd629cdSMarshall Clow 
41acd629cdSMarshall Clow     {
42acd629cdSMarshall Clow //  priority_queue(Iter, Iter, Comp, Container)
43acd629cdSMarshall Clow //  float is not an iterator
44acd629cdSMarshall Clow     std::priority_queue pri(23.f, 2.f, std::greater<float>(), std::deque<float>());   // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'priority_queue'}}
45acd629cdSMarshall Clow     }
46acd629cdSMarshall Clow 
47acd629cdSMarshall Clow //  Test the implicit deduction guides
48acd629cdSMarshall Clow     {
49acd629cdSMarshall Clow //  priority_queue (allocator &)
50acd629cdSMarshall Clow     std::priority_queue pri((std::allocator<int>()));  // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'priority_queue'}}
51acd629cdSMarshall Clow //  Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
52acd629cdSMarshall Clow //  Also, we can't use {} instead of parens, because that constructs a
53acd629cdSMarshall Clow //      stack<allocator<int>, allocator<allocator<int>>>
54acd629cdSMarshall Clow     }
55acd629cdSMarshall Clow 
562df59c50SJF Bastien 
572df59c50SJF Bastien   return 0;
58acd629cdSMarshall Clow }
59