# define _LIBCPP_COMPILER_GCC
# elif defined(_MSC_VER)
# define _LIBCPP_COMPILER_MSVC
-# elif defined(__IBMCPP__)
-# define _LIBCPP_COMPILER_IBM
# endif
# if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
# define _LIBCPP_DISABLE_EXTENSION_WARNING
-# elif defined(_LIBCPP_COMPILER_IBM)
-
-# define _ALIGNAS(x) __attribute__((__aligned__(x)))
-# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))
-# define _ATTRIBUTE(x) __attribute__((x))
-# define _LIBCPP_NORETURN __attribute__((noreturn))
-
-# define _LIBCPP_HAS_NO_UNICODE_CHARS
-
-# if defined(_AIX)
-# define __MULTILOCALE_API
-# endif
-
-# define _LIBCPP_HAS_NO_ASAN
-
-# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
-
-# define _LIBCPP_HAS_NO_VECTOR_EXTENSION
-
-# define _LIBCPP_DISABLE_EXTENSION_WARNING
-
-# endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
+# endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC]
# if defined(_LIBCPP_OBJECT_FORMAT_COFF)
# define _NOEXCEPT_(x)
# endif
-# ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
- typedef unsigned short char16_t;
-typedef unsigned int char32_t;
-# endif
-
# ifndef __SIZEOF_INT128__
# define _LIBCPP_HAS_NO_INT128
# endif
};
#endif // !_LIBCPP_HAS_NO_CHAR8_T
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
};
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
-
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <>
#endif // _LIBCPP_HAS_NO_CHAR8_T
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-
template <>
struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>
{
return nullptr;
}
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
-
// helper fns for basic_string and string_view
// __str_find
#ifndef _LIBCPP_HAS_NO_CHAR8_T
template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; };
#endif
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <> struct __libcpp_is_integral<char16_t> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<char32_t> { enum { value = 1 }; };
-#endif
template <> struct __libcpp_is_integral<short> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<unsigned short> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<int> { enum { value = 1 }; };
template<class _Tp>
concept __is_safe_integral_cmp = is_integral_v<_Tp> &&
- !_IsSameAsAny<_Tp, bool, char
+ !_IsSameAsAny<_Tp, bool, char, char16_t, char32_t
#ifndef _LIBCPP_HAS_NO_CHAR8_T
, char8_t
#endif
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- , char16_t, char32_t
-#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
, wchar_t
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
typedef fpos<mbstate_t> u8streampos;
#endif
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef fpos<mbstate_t> u16streampos;
typedef fpos<mbstate_t> u32streampos;
-#endif
#if defined(_NEWLIB_VERSION)
// On newlib, off_t is 'long int'
#include <__utility/unreachable.h>
#include <climits>
#include <compare>
+#include <cstdint>
#include <cstdio> // EOF
#include <cstdlib>
#include <cstring>
# include <cwchar>
#endif
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-# include <cstdint>
-#endif
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
typedef basic_string<char8_t> u8string;
#endif
-
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
-#endif
struct __uninitialized_size_tag {};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
_LIBCPP_PREFERRED_NAME(u8string)
#endif
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
_LIBCPP_PREFERRED_NAME(u16string)
_LIBCPP_PREFERRED_NAME(u32string)
-#endif
basic_string
{
public:
assert(wstr.max_size() == std::numeric_limits<size_t>::max() / sizeof(wchar_t) - alignment);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
std::u16string u16str;
std::u32string u32str;
assert(u16str.max_size() == std::numeric_limits<size_t>::max() / 2 - alignment);
assert(u32str.max_size() == std::numeric_limits<size_t>::max() / 4 - alignment);
-#endif
}
void half_size() {
assert(wstr.max_size() == std::numeric_limits<size_t>::max() / std::max<size_t>(2ul, sizeof(wchar_t)) - alignment);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
std::u16string u16str;
std::u32string u32str;
assert(u16str.max_size() == std::numeric_limits<size_t>::max() / 2 - alignment);
assert(u32str.max_size() == std::numeric_limits<size_t>::max() / 4 - alignment);
-#endif
}
bool test() {
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif
return true;
}
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif
return true;
}
#ifndef _LIBCPP_HAS_NO_CHAR8_T
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif
return true;
}
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<std::atomic_char8_t, char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<std::atomic_char16_t, char16_t>();
test<std::atomic_char32_t, char32_t>();
-#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<std::atomic_wchar_t, wchar_t>();
#endif
test<volatile std::atomic_ulong, unsigned long>();
test<volatile std::atomic_llong, long long>();
test<volatile std::atomic_ullong, unsigned long long>();
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<volatile std::atomic_char16_t, char16_t>();
test<volatile std::atomic_char32_t, char32_t>();
-#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<volatile std::atomic_wchar_t, wchar_t>();
#endif
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
static_assert((std::is_same<std::atomic<char8_t>, std::atomic_char8_t>::value), "");
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
-#endif
// Added by LWG 2441
static_assert((std::is_same<std::atomic<intptr_t>, std::atomic_intptr_t>::value), "");
#ifndef TEST_HAS_NO_CHAR8_T
static_assert(std::three_way_comparable<char8_t const&>);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
static_assert(std::three_way_comparable<char16_t volatile&>);
static_assert(std::three_way_comparable<char32_t const volatile&>);
-#endif
#ifndef TEST_HAS_NO_INT128
static_assert(std::three_way_comparable<__int128_t const&>);
static_assert(std::three_way_comparable<__uint128_t const&>);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif
test<signed char>();
test<unsigned char>();
test<signed short>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
-#endif
test<short>(0);
test<unsigned short>(0);
test<int>(0);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 8>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 16>();
test<char32_t, 32>();
-#endif
test<short, 15>();
test<unsigned short, 16>();
test<int, 31>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 2>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 4>();
test<char32_t, 9>();
-#endif
test<short, 4>();
test<unsigned short, 4>();
test<int, 9>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
-#endif
test<short>(0);
test<unsigned short>(0);
test<int>(0);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, std::denorm_absent>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, std::denorm_absent>();
test<char32_t, std::denorm_absent>();
-#endif
test<short, std::denorm_absent>();
test<unsigned short, std::denorm_absent>();
test<int, std::denorm_absent>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
-#endif
test<short, false>();
test<unsigned short, false>();
test<int, false>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
-#endif
test<short, false>();
test<unsigned short, false>();
test<int, false>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
-#endif
test<short, false>();
test<unsigned short, false>();
test<int, false>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
-#endif
test<short, false>();
test<unsigned short, false>();
test<int, false>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
-#endif
test<short>(0);
test<unsigned short>(0);
test<int>(0);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
-#endif
test<short, true>();
test<unsigned short, true>();
test<int, true>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
-#endif
test<short, true>();
test<unsigned short, true>();
test<int, true>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
-#endif
test<short, false>();
test<unsigned short, false>();
test<int, false>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
-#endif
test<short, true>();
test<unsigned short, true>();
test<int, true>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, true>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
-#endif
test<short, false>();
test<unsigned short, true>();
test<int, false>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
-#endif
test<short, true>();
test<unsigned short, false>();
test<int, true>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
-#endif
test<short>(SHRT_MIN);
test<unsigned short>(0);
test<int>(INT_MIN);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(UCHAR_MAX); // ??
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(USHRT_MAX);
test<char32_t>(UINT_MAX);
-#endif
test<short>(SHRT_MAX);
test<unsigned short>(USHRT_MAX);
test<int>(INT_MAX);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
-#endif
test<short, 0>();
test<unsigned short, 0>();
test<int, 0>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
-#endif
test<short, 0>();
test<unsigned short, 0>();
test<int, 0>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
-#endif
test<short, 0>();
test<unsigned short, 0>();
test<int, 0>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
-#endif
test<short>(SHRT_MIN);
test<unsigned short>(0);
test<int>(INT_MIN);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
-#endif
test<short, 0>();
test<unsigned short, 0>();
test<int, 0>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 0>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
-#endif
test<short, 0>();
test<unsigned short, 0>();
test<int, 0>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif
test<short>();
test<unsigned short>();
test<int>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, 2>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, 2>();
test<char32_t, 2>();
-#endif
test<short, 2>();
test<unsigned short, 2>();
test<int, 2>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>(0);
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
-#endif
test<short>(0);
test<unsigned short>(0);
test<int>(0);
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, std::round_toward_zero>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, std::round_toward_zero>();
test<char32_t, std::round_toward_zero>();
-#endif
test<short, std::round_toward_zero>();
test<unsigned short, std::round_toward_zero>();
test<int, std::round_toward_zero>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif // TEST_HAS_NO_UNICODE_CHARS
test<short>();
test<unsigned short>();
test<int>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, false>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
-#endif
test<short, false>();
test<unsigned short, false>();
test<int, false>();
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
test<char8_t, integral_types_trap>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t, integral_types_trap>();
test<char32_t, integral_types_trap>();
-#endif
test<short, integral_types_trap>();
test<unsigned short, integral_types_trap>();
test<int, integral_types_trap>();
#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
test_hash_enabled_for_type<std::u8string>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test_hash_enabled_for_type<std::u16string>();
test_hash_enabled_for_type<std::u32string>();
-#endif
}
return 0;
#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
test<std::u8string>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<std::u16string>();
test<std::u32string>();
-#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<std::wstring>();
#endif
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
char16_t c = u'\0';
std::char_traits<char16_t>::assign(c, u'a');
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
TEST_CONSTEXPR_CXX20 bool test()
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char16_t s2[3] = {0};
assert(std::char_traits<char16_t>::assign(s2, 3, char16_t(5)) == s2);
assert(s2[0] == char16_t(5));
assert(s2[1] == char16_t(5));
assert(s2[2] == char16_t(5));
assert(std::char_traits<char16_t>::assign(NULL, 0, char16_t(5)) == NULL);
-#endif // TEST_HAS_NO_UNICODE_CHARS
return true;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::compare(u"", u"", 0) == 0);
assert(std::char_traits<char16_t>::compare(NULL, NULL, 0) == 0);
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
TEST_CONSTEXPR_CXX20 bool test()
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char16_t s1[] = {1, 2, 3};
char16_t s2[3] = {0};
assert(std::char_traits<char16_t>::copy(s2, s1, 3) == s2);
assert(s2[2] == char16_t(3));
assert(std::char_traits<char16_t>::copy(NULL, s1, 0) == NULL);
assert(std::char_traits<char16_t>::copy(s1, NULL, 0) == s1);
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return true;
+ return true;
}
int main(int, char**)
static_assert(test());
#endif
- return 0;
+ return 0;
}
// static constexpr int_type eof();
#include <string>
-#include <cassert>
-
-#include "test_macros.h"
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
std::char_traits<char16_t>::int_type i = std::char_traits<char16_t>::eof();
((void)i); // Prevent unused warning
-#endif
-
- return 0;
+ return 0;
}
// static constexpr bool eq(char_type c1, char_type c2);
+// UNSUPPORTED: c++03
+
#include <string>
#include <cassert>
-#include "test_macros.h"
-
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
-#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::eq(u'a', u'a'));
assert(!std::char_traits<char16_t>::eq(u'a', u'A'));
-#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
-
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert( std::char_traits<char16_t>::eq_int_type(u'a', u'a'));
assert(!std::char_traits<char16_t>::eq_int_type(u'a', u'A'));
#endif
assert( std::char_traits<char16_t>::eq_int_type(std::char_traits<char16_t>::eof(),
std::char_traits<char16_t>::eof()));
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char16_t s1[] = {1, 2, 3};
assert(std::char_traits<char16_t>::find(s1, 3, char16_t(1)) == s1);
assert(std::char_traits<char16_t>::find(s1, 3, char16_t(2)) == s1+1);
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::length(u"") == 0);
assert(std::char_traits<char16_t>::length(u"a") == 1);
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
// static constexpr bool lt(char_type c1, char_type c2);
+// UNSUPPORTED: c++03
+
#include <string>
#include <cassert>
-#include "test_macros.h"
-
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
-#if TEST_STD_VER >= 11
assert(!std::char_traits<char16_t>::lt(u'a', u'a'));
assert( std::char_traits<char16_t>::lt(u'A', u'a'));
-#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
-
- return 0;
+ return 0;
}
TEST_CONSTEXPR_CXX20 bool test()
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char16_t s1[] = {1, 2, 3};
assert(std::char_traits<char16_t>::move(s1, s1+1, 2) == s1);
assert(s1[0] == char16_t(2));
assert(s1[2] == char16_t(3));
assert(std::char_traits<char16_t>::move(NULL, s1, 0) == NULL);
assert(std::char_traits<char16_t>::move(s1, NULL, 0) == s1);
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return true;
+ return true;
}
int main(int, char**)
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::not_eof(u'a') == u'a');
assert(std::char_traits<char16_t>::not_eof(u'A') == u'A');
assert(std::char_traits<char16_t>::not_eof(0) == 0);
assert(std::char_traits<char16_t>::not_eof(std::char_traits<char16_t>::eof()) !=
std::char_traits<char16_t>::eof());
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::to_char_type(u'a') == u'a');
assert(std::char_traits<char16_t>::to_char_type(u'A') == u'A');
#endif
assert(std::char_traits<char16_t>::to_char_type(0) == 0);
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char16_t>::to_int_type(u'a') == u'a');
assert(std::char_traits<char16_t>::to_int_type(u'A') == u'A');
#endif
assert(std::char_traits<char16_t>::to_int_type(0) == 0);
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
static_assert((std::is_same<std::char_traits<char16_t>::char_type, char16_t>::value), "");
static_assert((std::is_same<std::char_traits<char16_t>::int_type, std::uint_least16_t>::value), "");
static_assert((std::is_same<std::char_traits<char16_t>::off_type, std::streamoff>::value), "");
static_assert((std::is_same<std::char_traits<char16_t>::pos_type, std::u16streampos>::value), "");
static_assert((std::is_same<std::char_traits<char16_t>::state_type, std::mbstate_t>::value), "");
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
char32_t c = U'\0';
std::char_traits<char32_t>::assign(c, U'a');
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
TEST_CONSTEXPR_CXX20 bool test()
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char32_t s2[3] = {0};
assert(std::char_traits<char32_t>::assign(s2, 3, char32_t(5)) == s2);
assert(s2[0] == char32_t(5));
assert(s2[1] == char32_t(5));
assert(s2[2] == char32_t(5));
assert(std::char_traits<char32_t>::assign(NULL, 0, char32_t(5)) == NULL);
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return true;
+ return true;
}
int main(int, char**)
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::compare(U"", U"", 0) == 0);
assert(std::char_traits<char32_t>::compare(NULL, NULL, 0) == 0);
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
return 0;
}
TEST_CONSTEXPR_CXX20 bool test()
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char32_t s1[] = {1, 2, 3};
char32_t s2[3] = {0};
assert(std::char_traits<char32_t>::copy(s2, s1, 3) == s2);
assert(s2[2] == char32_t(3));
assert(std::char_traits<char32_t>::copy(NULL, s1, 0) == NULL);
assert(std::char_traits<char32_t>::copy(s1, NULL, 0) == s1);
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return true;
+ return true;
}
int main(int, char**)
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
std::char_traits<char32_t>::int_type i = std::char_traits<char32_t>::eof();
((void)i); // Prevent unused warning
-#endif
- return 0;
+ return 0;
}
// static constexpr bool eq(char_type c1, char_type c2);
+// UNSUPPORTED: c++03
+
#include <string>
#include <cassert>
-#include "test_macros.h"
-
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
-#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::eq(U'a', U'a'));
assert(!std::char_traits<char32_t>::eq(U'a', U'A'));
-#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
-
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert( std::char_traits<char32_t>::eq_int_type(U'a', U'a'));
assert(!std::char_traits<char32_t>::eq_int_type(U'a', U'A'));
#endif
assert( std::char_traits<char32_t>::eq_int_type(std::char_traits<char32_t>::eof(),
std::char_traits<char32_t>::eof()));
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char32_t s1[] = {1, 2, 3};
assert(std::char_traits<char32_t>::find(s1, 3, char32_t(1)) == s1);
assert(std::char_traits<char32_t>::find(s1, 3, char32_t(2)) == s1+1);
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::length(U"") == 0);
assert(std::char_traits<char32_t>::length(U"a") == 1);
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "" );
#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
// static constexpr bool lt(char_type c1, char_type c2);
+// UNSUPPORTED: c++03
+
#include <string>
#include <cassert>
-#include "test_macros.h"
-
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
-#if TEST_STD_VER >= 11
assert(!std::char_traits<char32_t>::lt(U'a', U'a'));
assert( std::char_traits<char32_t>::lt(U'A', U'a'));
-#endif
-#endif // TEST_HAS_NO_UNICODE_CHARS
-
- return 0;
+ return 0;
}
TEST_CONSTEXPR_CXX20 bool test()
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char32_t s1[] = {1, 2, 3};
assert(std::char_traits<char32_t>::move(s1, s1+1, 2) == s1);
assert(s1[0] == char32_t(2));
assert(s1[2] == char32_t(3));
assert(std::char_traits<char32_t>::move(NULL, s1, 0) == NULL);
assert(std::char_traits<char32_t>::move(s1, NULL, 0) == s1);
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return true;
+ return true;
}
int main(int, char**)
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::not_eof(U'a') == U'a');
assert(std::char_traits<char32_t>::not_eof(U'A') == U'A');
assert(std::char_traits<char32_t>::not_eof(0) == 0);
assert(std::char_traits<char32_t>::not_eof(std::char_traits<char32_t>::eof()) !=
std::char_traits<char32_t>::eof());
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::to_char_type(U'a') == U'a');
assert(std::char_traits<char32_t>::to_char_type(U'A') == U'A');
#endif
assert(std::char_traits<char32_t>::to_char_type(0) == 0);
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
int main(int, char**)
{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
assert(std::char_traits<char32_t>::to_int_type(U'a') == U'a');
assert(std::char_traits<char32_t>::to_int_type(U'A') == U'A');
#endif
assert(std::char_traits<char32_t>::to_int_type(0) == 0);
-#endif // TEST_HAS_NO_UNICODE_CHARS
- return 0;
+ return 0;
}
#include <type_traits>
#include <cstdint>
-#include "test_macros.h"
-
-int main(int, char**)
-{
-#ifndef TEST_HAS_NO_UNICODE_CHARS
- static_assert((std::is_same<std::char_traits<char32_t>::char_type, char32_t>::value), "");
- static_assert((std::is_same<std::char_traits<char32_t>::int_type, std::uint_least32_t>::value), "");
- static_assert((std::is_same<std::char_traits<char32_t>::off_type, std::streamoff>::value), "");
- static_assert((std::is_same<std::char_traits<char32_t>::pos_type, std::u32streampos>::value), "");
- static_assert((std::is_same<std::char_traits<char32_t>::state_type, std::mbstate_t>::value), "");
-#endif // TEST_HAS_NO_UNICODE_CHARS
-
- return 0;
-}
+static_assert((std::is_same<std::char_traits<char32_t>::char_type, char32_t>::value), "");
+static_assert((std::is_same<std::char_traits<char32_t>::int_type, std::uint_least32_t>::value), "");
+static_assert((std::is_same<std::char_traits<char32_t>::off_type, std::streamoff>::value), "");
+static_assert((std::is_same<std::char_traits<char32_t>::pos_type, std::u32streampos>::value), "");
+static_assert((std::is_same<std::char_traits<char32_t>::state_type, std::mbstate_t>::value), "");
#include "test_macros.h"
-int main(int, char**)
-{
- static_assert((std::is_same<std::string, std::basic_string<char> >::value), "");
+static_assert((std::is_same<std::string, std::basic_string<char> >::value), "");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
- static_assert((std::is_same<std::wstring, std::basic_string<wchar_t> >::value), "");
+static_assert((std::is_same<std::wstring, std::basic_string<wchar_t> >::value), "");
#endif
#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
- static_assert((std::is_same<std::u8string, std::basic_string<char8_t> >::value), "");
+static_assert((std::is_same<std::u8string, std::basic_string<char8_t> >::value), "");
#endif
-#ifndef TEST_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 // TEST_HAS_NO_UNICODE_CHARS
-
- return 0;
-}
+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), "");
assert( test<std::u8string_view> (u8"1234"));
#endif
#if TEST_STD_VER >= 11
-# ifndef TEST_HAS_NO_UNICODE_CHARS
assert( test<std::u16string_view> ( u"1234"));
assert( test<std::u32string_view> ( U"1234"));
-# endif
#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
assert( test<std::wstring_view> ( L"1234"));
# if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
static_assert( test<std::u8string_view> ({u8"abc", 3}), "");
# endif
-# ifndef TEST_HAS_NO_UNICODE_CHARS
static_assert( test<std::u16string_view> ({ u"abc", 3}), "");
static_assert( test<std::u32string_view> ({ U"abc", 3}), "");
-# endif
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
static_assert( test<std::wstring_view> ({ L"abc", 3}), "");
# endif
#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
test_hash_enabled_for_type<std::u8string_view>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test_hash_enabled_for_type<std::u16string_view>();
test_hash_enabled_for_type<std::u32string_view>();
-#endif
}
return 0;
#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
test<std::u8string_view>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<std::u16string_view>();
test<std::u32string_view>();
-#endif
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test<std::wstring_view>();
#endif
#ifndef TEST_HAS_NO_CHAR8_T
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif
}
int main(int, char**) {
std::make_format_args<std::basic_format_context<
std::back_insert_iterator<std::basic_string<char8_t>>, char8_t>>()));
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test(std::basic_format_args(
std::make_format_args<std::basic_format_context<
std::back_insert_iterator<std::basic_string<char16_t>>,
std::make_format_args<std::basic_format_context<
std::back_insert_iterator<std::basic_string<char32_t>>,
char32_t>>()));
-#endif
}
int main(int, char**) {
std::make_format_args<std::basic_format_context<
std::back_insert_iterator<std::basic_string<char8_t>>, char8_t>>()));
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test(std::basic_format_args(
std::make_format_args<std::basic_format_context<
std::back_insert_iterator<std::basic_string<char16_t>>,
std::make_format_args<std::basic_format_context<
std::back_insert_iterator<std::basic_string<char32_t>>,
char32_t>>()));
-#endif
}
int main(int, char**) {
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test(u"abc");
test(U"abc");
-#endif
return true;
}
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test(u"abc");
test(U"abc");
-#endif
return true;
}
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test(u"abc");
test(U"abc");
-#endif
return true;
}
#ifndef TEST_HAS_NO_CHAR8_T
test(u8"abc");
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test(u"abc");
test(U"abc");
-#endif
return true;
}
#ifndef TEST_HAS_NO_CHAR8_T
test<char8_t>();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
-#endif
}
static_assert(std::is_same_v<std::format_parse_context,
}
#endif // TEST_HAS_NO_CHAR8_T
-#ifndef TEST_HAS_NO_UNICODE_CHARS
template <class T>
constexpr void test_uchars() {
std::cmp_equal(T(), T()); // expected-error 2 {{no matching function for call to 'cmp_equal'}}
std::in_range<T>(int()); // expected-error 2 {{no matching function for call to 'in_range'}}
std::in_range<int>(T()); // expected-error 2 {{no matching function for call to 'in_range'}}
}
-#endif // TEST_HAS_NO_UNICODE_CHARS
int main(int, char**) {
test<bool>();
test_char8t<char8_t>();
#endif // TEST_HAS_NO_CHAR8_T
-#ifndef TEST_HAS_NO_UNICODE_CHARS
test_uchars<char16_t>();
test_uchars<char32_t>();
-#endif
return 0;
}
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
TestFunctor<char8_t>()();
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
TestFunctor<char16_t>()();
TestFunctor<char32_t>()();
-#endif
TestFunctor<int8_t>()();
TestFunctor<uint8_t>()();
TestFunctor<int16_t>()();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
wchar_t,
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
char16_t,
char32_t,
-#endif
short,
unsigned short,
int,
== u8" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN"
"OPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
#endif
-#ifndef TEST_HAS_NO_UNICODE_CHARS
assert(MAKE_STRING(char16_t,
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN"
"OPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~")
"OPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~")
== U" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN"
"OPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
-#endif
// clang-format on
return 0;
# define TEST_HAS_NO_INT128
#endif
-#if defined(_LIBCPP_HAS_NO_UNICODE_CHARS)
-# define TEST_HAS_NO_UNICODE_CHARS
-#endif
-
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
# define TEST_HAS_NO_LOCALIZATION
#endif