blob: 54a0690e48e50794183aad25d5224b9d5cf4b8c2 [file] [log] [blame]
Marshall Clow053d81c2016-07-21 05:31:24 +00001//===----------------------------------------------------------------------===//
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
11// <string_view>
12
13// constexpr basic_string_view () noexcept;
14
15#include <string_view>
16#include <cassert>
17
18template<typename T>
19void test () {
20#if _LIBCPP_STD_VER > 11
21 {
22 constexpr T sv1;
23 static_assert ( sv1.size() == 0, "" );
24 static_assert ( sv1.empty(), "");
25 }
26#endif
27
28 {
29 T sv1;
30 assert ( sv1.size() == 0 );
31 assert ( sv1.empty());
32 }
33}
34
35int main () {
36 typedef std::string_view string_view;
37 typedef std::u16string_view u16string_view;
38 typedef std::u32string_view u32string_view;
39 typedef std::wstring_view wstring_view;
40
41 test<string_view> ();
42 test<u16string_view> ();
43 test<u32string_view> ();
44 test<wstring_view> ();
45
46}