xref: /llvm-project/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp (revision eb1ceb17ae9716a738eac4ab30872bfc3c7268ef)
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 // <string>
10 
11 // Test for the existence of:
12 
13 // basic_string typedef names
14 // typedef basic_string<char>     string;
15 // typedef basic_string<char16_t> u16string;
16 // typedef basic_string<char8_t>  u8string;  // C++20
17 // typedef basic_string<char32_t> u32string;
18 // typedef basic_string<wchar_t>  wstring;
19 
20 #include <string>
21 #include <type_traits>
22 
23 #include "test_macros.h"
24 
25 static_assert((std::is_same<std::string, std::basic_string<char> >::value), "");
26 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
27 static_assert((std::is_same<std::wstring, std::basic_string<wchar_t> >::value), "");
28 #endif
29 #ifndef TEST_HAS_NO_CHAR8_T
30 static_assert((std::is_same<std::u8string, std::basic_string<char8_t> >::value), "");
31 #endif
32 static_assert((std::is_same<std::u16string, std::basic_string<char16_t> >::value), "");
33 static_assert((std::is_same<std::u32string, std::basic_string<char32_t> >::value), "");
34