Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / container.adaptors / stack / stack.cons / deduct.verify.cpp
blob55296f4122335fc0ab2ff8acc8a7a82d79ecd9db
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 // <stack>
10 // UNSUPPORTED: c++03, c++11, c++14
12 // template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
13 // vector(InputIterator, InputIterator, Allocator = Allocator())
14 // -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
18 #include <stack>
19 #include <list>
20 #include <iterator>
21 #include <cassert>
22 #include <cstddef>
25 int main(int, char**)
27 // Test the explicit deduction guides
29 // stack(const Container&, const Alloc&);
30 // The '45' is not an allocator
31 std::stack stk(std::list<int>({1,2,3}), 45); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'stack'}}
35 // stack(const stack&, const Alloc&);
36 // The '45' is not an allocator
37 std::stack<int> source;
38 std::stack stk(source, 45); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'stack'}}
41 // Test the implicit deduction guides
43 // stack (allocator &)
44 std::stack stk((std::allocator<int>())); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'stack'}}
45 // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
46 // Also, we can't use {} instead of parens, because that constructs a
47 // stack<allocator<int>, allocator<allocator<int>>>
51 return 0;