]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp
Vendor import of libc++ trunk r351319 (just before the release_80
[FreeBSD/FreeBSD.git] / test / std / strings / char.traits / char.traits.specializations / char.traits.specializations.char8_t / types.pass.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 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
10
11 // <string>
12
13 // template<> struct char_traits<char8_t>
14
15 // typedef char8_t       char_type;
16 // typedef unsigned int   int_type;
17 // typedef streamoff      off_type;
18 // typedef u16streampos   pos_type;
19 // typedef mbstate_t      state_type;
20
21 #include <string>
22 #include <type_traits>
23 #include <cstdint>
24
25 int main()
26 {
27 #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
28     static_assert((std::is_same<std::char_traits<char8_t>::char_type,  char8_t>::value), "");
29     static_assert((std::is_same<std::char_traits<char8_t>::int_type,   unsigned int>::value), "");
30     static_assert((std::is_same<std::char_traits<char8_t>::off_type,   std::streamoff>::value), "");
31     static_assert((std::is_same<std::char_traits<char8_t>::pos_type,   std::u16streampos>::value), "");
32     static_assert((std::is_same<std::char_traits<char8_t>::state_type, std::mbstate_t>::value), "");
33 #endif
34 }