15b8b8b5dSMarshall Clow //===----------------------------------------------------------------------===//
25b8b8b5dSMarshall 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
65b8b8b5dSMarshall Clow //
75b8b8b5dSMarshall Clow //===----------------------------------------------------------------------===//
85b8b8b5dSMarshall Clow
95b8b8b5dSMarshall Clow // <stack>
10*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
115b8b8b5dSMarshall Clow
125b8b8b5dSMarshall Clow // template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
135b8b8b5dSMarshall Clow // vector(InputIterator, InputIterator, Allocator = Allocator())
145b8b8b5dSMarshall Clow // -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
155b8b8b5dSMarshall Clow //
165b8b8b5dSMarshall Clow
175b8b8b5dSMarshall Clow
185b8b8b5dSMarshall Clow #include <stack>
195b8b8b5dSMarshall Clow #include <list>
205b8b8b5dSMarshall Clow #include <iterator>
215b8b8b5dSMarshall Clow #include <cassert>
225b8b8b5dSMarshall Clow #include <cstddef>
235b8b8b5dSMarshall Clow
245b8b8b5dSMarshall Clow
main(int,char **)252df59c50SJF Bastien int main(int, char**)
265b8b8b5dSMarshall Clow {
275b8b8b5dSMarshall Clow // Test the explicit deduction guides
285b8b8b5dSMarshall Clow {
295b8b8b5dSMarshall Clow // stack(const Container&, const Alloc&);
305b8b8b5dSMarshall Clow // The '45' is not an allocator
315b8b8b5dSMarshall Clow 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'}}
325b8b8b5dSMarshall Clow }
335b8b8b5dSMarshall Clow
345b8b8b5dSMarshall Clow {
355b8b8b5dSMarshall Clow // stack(const stack&, const Alloc&);
365b8b8b5dSMarshall Clow // The '45' is not an allocator
375b8b8b5dSMarshall Clow std::stack<int> source;
385b8b8b5dSMarshall Clow std::stack stk(source, 45); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'stack'}}
395b8b8b5dSMarshall Clow }
405b8b8b5dSMarshall Clow
415b8b8b5dSMarshall Clow // Test the implicit deduction guides
425b8b8b5dSMarshall Clow {
435b8b8b5dSMarshall Clow // stack (allocator &)
445b8b8b5dSMarshall Clow std::stack stk((std::allocator<int>())); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'stack'}}
455b8b8b5dSMarshall Clow // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
465b8b8b5dSMarshall Clow // Also, we can't use {} instead of parens, because that constructs a
475b8b8b5dSMarshall Clow // stack<allocator<int>, allocator<allocator<int>>>
485b8b8b5dSMarshall Clow }
495b8b8b5dSMarshall Clow
502df59c50SJF Bastien
512df59c50SJF Bastien return 0;
525b8b8b5dSMarshall Clow }
53