summaryrefslogtreecommitdiff
path: root/test/std/strings/string.classes/typedefs.pass.cpp
blob: 15d97123519de1b50e47c3e9ac227b94c293a330 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <string>

// Test for the existence of:

// basic_string typedef names
// typedef basic_string<char>     string;
// typedef basic_string<char16_t> u16string;
// typedef basic_string<char8_t>  u8string;  // C++20
// typedef basic_string<char32_t> u32string;
// typedef basic_string<wchar_t>  wstring;

#include <string>
#include <type_traits>

#include "test_macros.h"

int main()
{
    static_assert((std::is_same<std::string, std::basic_string<char> >::value), "");
    static_assert((std::is_same<std::wstring, std::basic_string<wchar_t> >::value), "");
#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
    static_assert((std::is_same<std::u8string, std::basic_string<char8_t> >::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
    static_assert((std::is_same<std::u16string, std::basic_string<char16_t> >::value), "");
    static_assert((std::is_same<std::u32string, std::basic_string<char32_t> >::value), "");
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
}