deduct.fail.cpp (1361B)
1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <array> 11 // UNSUPPORTED: c++98, c++03, c++11, c++14 12 // UNSUPPORTED: libcpp-no-deduction-guides 13 14 15 // template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>> 16 // deque(InputIterator, InputIterator, Allocator = Allocator()) 17 // -> deque<typename iterator_traits<InputIterator>::value_type, Allocator>; 18 // 19 20 21 #include <deque> 22 #include <iterator> 23 #include <cassert> 24 #include <cstddef> 25 #include <climits> // INT_MAX 26 27 struct A {}; 28 29 int main() 30 { 31 // Test the explicit deduction guides 32 33 // Test the implicit deduction guides 34 { 35 // deque (allocator &) 36 std::deque deq((std::allocator<int>())); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'deque'}} 37 // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration. 38 // Also, we can't use {} instead of parens, because that constructs a 39 // deque<allocator<int>, allocator<allocator<int>>> 40 } 41 42 }