]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/strings/basic.string/string.cons/string_view_size_size_deduction.fail.cpp
Vendor import of libc++ trunk r351319 (just before the release_80
[FreeBSD/FreeBSD.git] / test / std / strings / basic.string / string.cons / string_view_size_size_deduction.fail.cpp
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 // <string>
11 // UNSUPPORTED: c++98, c++03, c++11, c++14
12 // XFAIL: libcpp-no-deduction-guides
13
14 // template<class InputIterator>
15 //   basic_string(InputIterator begin, InputIterator end,
16 //   const Allocator& a = Allocator());
17
18 // template<class charT,
19 //          class traits,
20 //          class Allocator = allocator<charT>
21 //          >
22 // basic_string(basic_string_view<charT, traits>,
23 //                typename see below::size_type,
24 //                typename see below::size_type,
25 //                const Allocator& = Allocator())
26 //   -> basic_string<charT, traits, Allocator>;
27 //
28 //  A size_type parameter type in a basic_string deduction guide refers to the size_type
29 //  member type of the type deduced by the deduction guide.
30 //
31 //  The deduction guide shall not participate in overload resolution if Allocator
32 //  is a type that does not qualify as an allocator.
33
34
35 #include <string>
36 #include <string_view>
37 #include <iterator>
38 #include <cassert>
39 #include <cstddef>
40
41 int main()
42 {
43     {
44     std::string_view sv = "12345678901234";
45     std::basic_string s1{sv, 0, 4, 23}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_string'}}
46     }
47 }