1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: !stdlib=libc++ && (c++03 || c++11 || c++14)
10 
11 // <string_view>
12 
13 // template<class Allocator>
14 // basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept
15 
16 #include <string_view>
17 #include <string>
18 #include <cassert>
19 
20 struct dummy_char_traits : public std::char_traits<char> {};
21 
main(int,char **)22 int main(int, char**) {
23     using string_view = std::basic_string_view<char, dummy_char_traits>;
24     using string      = std::              basic_string     <char>;
25 
26     {
27     string s{"QBCDE"};
28     string_view sv1 ( s );
29     assert ( sv1.size() == s.size());
30     assert ( sv1.data() == s.data());
31     }
32 
33   return 0;
34 }
35