libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

deduct.fail.cpp (1324B)


      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 // <vector>
     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 //    vector(InputIterator, InputIterator, Allocator = Allocator())
     17 //    -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
     18 //
     19 
     20 
     21 #include <deque>
     22 #include <iterator>
     23 #include <cassert>
     24 #include <cstddef>
     25 
     26 
     27 int main()
     28 {
     29 //  Test the explicit deduction guides
     30 
     31 //  Test the implicit deduction guides
     32     {
     33 //  vector (allocator &)
     34     std::vector vec((std::allocator<int>()));  // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'vector'}}
     35 //  Note: The extra parens are necessary, since otherwise clang decides it is a function declaration.
     36 //  Also, we can't use {} instead of parens, because that constructs a
     37 //      deque<allocator<int>, allocator<allocator<int>>>
     38     }
     39 
     40 }