diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2018-05-22 01:57:53 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2018-05-22 01:57:53 +0000 |
| commit | 5b8b8b5dce587f1e5a4a31cc24f09b18bd53ff9a (patch) | |
| tree | 8f04be8d8eaf76d4e17086a1c1d3993a4beab9fa /libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.fail.cpp | |
| parent | 2d3eaeb2d485c464d493db9d301a2dd7e9d8d57c (diff) | |
| download | bcm5719-llvm-5b8b8b5dce587f1e5a4a31cc24f09b18bd53ff9a.tar.gz bcm5719-llvm-5b8b8b5dce587f1e5a4a31cc24f09b18bd53ff9a.zip | |
Deduction guides for the container adaptors - queue, stack, and priority_queue
llvm-svn: 332927
Diffstat (limited to 'libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.fail.cpp')
| -rw-r--r-- | libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.fail.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.fail.cpp b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.fail.cpp new file mode 100644 index 00000000000..e14965adadc --- /dev/null +++ b/libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.fail.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <stack> +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: libcpp-no-deduction-guides + + +// template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> +// vector(InputIterator, InputIterator, Allocator = Allocator()) +// -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>; +// + + +#include <stack> +#include <list> +#include <iterator> +#include <cassert> +#include <cstddef> + + +int main() +{ +// Test the explicit deduction guides + { +// stack(const Container&, const Alloc&); +// The '45' is not an allocator + 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'}} + } + + { +// stack(const stack&, const Alloc&); +// The '45' is not an allocator + std::stack<int> source; + std::stack stk(source, 45); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'stack'}} + } + +// Test the implicit deduction guides + { +// stack (allocator &) + std::stack stk((std::allocator<int>())); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'stack'}} +// Note: The extra parens are necessary, since otherwise clang decides it is a function declaration. +// Also, we can't use {} instead of parens, because that constructs a +// stack<allocator<int>, allocator<allocator<int>>> + } + +} |

