diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h --- a/libcxx/include/__string/char_traits.h +++ b/libcxx/include/__string/char_traits.h @@ -40,11 +40,11 @@ template struct _LIBCPP_TEMPLATE_VIS char_traits { - typedef _CharT char_type; - typedef int int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; + using char_type = _CharT; + using int_type = int; + using off_type = streamoff; + using pos_type = streampos; + using state_type = mbstate_t; static inline void _LIBCPP_CONSTEXPR_AFTER_CXX14 assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} @@ -189,11 +189,11 @@ template <> struct _LIBCPP_TEMPLATE_VIS char_traits { - typedef char char_type; - typedef int int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; + using char_type = char; + using int_type = int; + using off_type = streamoff; + using pos_type = streampos; + using state_type = mbstate_t; #if _LIBCPP_STD_VER > 17 using comparison_category = strong_ordering; #endif @@ -306,14 +306,14 @@ template <> struct _LIBCPP_TEMPLATE_VIS char_traits { - typedef wchar_t char_type; - typedef wint_t int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; -# if _LIBCPP_STD_VER > 17 + using char_type = wchar_t; + using int_type = wint_t; + using off_type = streamoff; + using pos_type = streampos; + using state_type = mbstate_t; +#if _LIBCPP_STD_VER > 17 using comparison_category = strong_ordering; -# endif +#endif static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} @@ -425,14 +425,14 @@ template <> struct _LIBCPP_TEMPLATE_VIS char_traits { - typedef char8_t char_type; - typedef unsigned int int_type; - typedef streamoff off_type; - typedef u8streampos pos_type; - typedef mbstate_t state_type; -# if _LIBCPP_STD_VER > 17 + using char_type = char8_t; + using int_type = unsigned int; + using off_type = streamoff; + using pos_type = u8streampos; + using state_type = mbstate_t; +#if _LIBCPP_STD_VER > 17 using comparison_category = strong_ordering; -# endif +#endif static inline constexpr void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} @@ -529,11 +529,11 @@ template <> struct _LIBCPP_TEMPLATE_VIS char_traits { - typedef char16_t char_type; - typedef uint_least16_t int_type; - typedef streamoff off_type; - typedef u16streampos pos_type; - typedef mbstate_t state_type; + using char_type = char16_t; + using int_type = uint_least16_t; + using off_type = streamoff; + using pos_type = u16streampos; + using state_type = mbstate_t; #if _LIBCPP_STD_VER > 17 using comparison_category = strong_ordering; #endif @@ -623,11 +623,11 @@ template <> struct _LIBCPP_TEMPLATE_VIS char_traits { - typedef char32_t char_type; - typedef uint_least32_t int_type; - typedef streamoff off_type; - typedef u32streampos pos_type; - typedef mbstate_t state_type; + using char_type = char32_t; + using int_type = uint_least32_t; + using off_type = streamoff; + using pos_type = u32streampos; + using state_type = mbstate_t; #if _LIBCPP_STD_VER > 17 using comparison_category = strong_ordering; #endif diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/types.compile.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/types.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/types.compile.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// using char_type = char; +// using int_type = int; +// using off_type = streamoff; +// using pos_type = streampos; +// using state_type = mbstate_t; +// using comparison_category = strong_ordering; + +#include +#include + +#include "test_macros.h" + +static_assert(std::is_same::char_type, char>::value, ""); +static_assert(std::is_same::int_type, int>::value, ""); +static_assert(std::is_same::off_type, std::streamoff>::value, ""); +static_assert(std::is_same::pos_type, std::streampos>::value, ""); +static_assert(std::is_same::state_type, std::mbstate_t>::value, ""); +#if TEST_STD_VER > 17 +static_assert(std::is_same_v::comparison_category, std::strong_ordering>); +#endif diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/types.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/types.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/types.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -// template<> struct char_traits - -// typedef char char_type; -// typedef int int_type; -// typedef streamoff off_type; -// typedef streampos pos_type; -// typedef mbstate_t state_type; -// using comparison_category = strong_ordering; - -#include -#include - -#include "test_macros.h" - -int main(int, char**) -{ - static_assert((std::is_same::char_type, char>::value), ""); - static_assert((std::is_same::int_type, int>::value), ""); - static_assert((std::is_same::off_type, std::streamoff>::value), ""); - static_assert((std::is_same::pos_type, std::streampos>::value), ""); - static_assert((std::is_same::state_type, std::mbstate_t>::value), ""); -#if TEST_STD_VER > 17 - static_assert(std::is_same_v::comparison_category, std::strong_ordering>); -#endif - - return 0; -} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/types.compile.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/types.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/types.compile.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// using char_type = char16_t; +// using int_type = uint_least16_t; +// using off_type = streamoff; +// using pos_type = u16streampos; +// using state_type = mbstate_t; +// using comparison_category = strong_ordering; + +#include +#include +#include + +#include "test_macros.h" + +static_assert(std::is_same::char_type, char16_t>::value, ""); +static_assert(std::is_same::int_type, std::uint_least16_t>::value, ""); +static_assert(std::is_same::off_type, std::streamoff>::value, ""); +static_assert(std::is_same::pos_type, std::u16streampos>::value, ""); +static_assert(std::is_same::state_type, std::mbstate_t>::value, ""); +#if TEST_STD_VER > 17 +static_assert(std::is_same_v::comparison_category, std::strong_ordering>); +#endif diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/types.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/types.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/types.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -// template<> struct char_traits - -// typedef char16_t char_type; -// typedef uint_least16_t int_type; -// typedef streamoff off_type; -// typedef u16streampos pos_type; -// typedef mbstate_t state_type; -// using comparison_category = strong_ordering; - -#include -#include -#include - -#include "test_macros.h" - -int main(int, char**) -{ - static_assert((std::is_same::char_type, char16_t>::value), ""); - static_assert((std::is_same::int_type, std::uint_least16_t>::value), ""); - static_assert((std::is_same::off_type, std::streamoff>::value), ""); - static_assert((std::is_same::pos_type, std::u16streampos>::value), ""); - static_assert((std::is_same::state_type, std::mbstate_t>::value), ""); -#if TEST_STD_VER > 17 - static_assert(std::is_same_v::comparison_category, std::strong_ordering>); -#endif - - return 0; -} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.compile.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.compile.pass.cpp --- a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.compile.pass.cpp +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.compile.pass.cpp @@ -10,11 +10,11 @@ // template<> struct char_traits -// typedef char32_t char_type; -// typedef uint_least32_t int_type; -// typedef streamoff off_type; -// typedef u32streampos pos_type; -// typedef mbstate_t state_type; +// using char_type = char32_t; +// using int_type = uint_least32_t; +// using off_type = streamoff; +// using pos_type = u32streampos; +// using state_type = mbstate_t; // using comparison_category = strong_ordering; #include @@ -23,11 +23,11 @@ #include "test_macros.h" -static_assert((std::is_same::char_type, char32_t>::value), ""); -static_assert((std::is_same::int_type, std::uint_least32_t>::value), ""); -static_assert((std::is_same::off_type, std::streamoff>::value), ""); -static_assert((std::is_same::pos_type, std::u32streampos>::value), ""); -static_assert((std::is_same::state_type, std::mbstate_t>::value), ""); +static_assert(std::is_same::char_type, char32_t>::value, ""); +static_assert(std::is_same::int_type, std::uint_least32_t>::value, ""); +static_assert(std::is_same::off_type, std::streamoff>::value, ""); +static_assert(std::is_same::pos_type, std::u32streampos>::value, ""); +static_assert(std::is_same::state_type, std::mbstate_t>::value, ""); #if TEST_STD_VER > 17 static_assert(std::is_same_v::comparison_category, std::strong_ordering>); #endif diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.compile.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.compile.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// template<> struct char_traits + +// using char_type = char8_t; +// using int_type = unsigned int; +// using off_type = streamoff; +// using pos_type = u8streampos; +// using state_type = mbstate_t; +// using comparison_category = strong_ordering; + +#include +#include +#include + +#include "test_macros.h" + +#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +static_assert(std::is_same::char_type, char8_t>::value); +static_assert(std::is_same::int_type, unsigned int>::value); +static_assert(std::is_same::off_type, std::streamoff>::value); +static_assert(std::is_same::pos_type, std::u8streampos>::value); +static_assert(std::is_same::state_type, std::mbstate_t>::value); +static_assert(std::is_same_v::comparison_category, std::strong_ordering>); +#endif diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// template<> struct char_traits - -// typedef char8_t char_type; -// typedef unsigned int int_type; -// typedef streamoff off_type; -// typedef u8streampos pos_type; -// typedef mbstate_t state_type; -// using comparison_category = strong_ordering; - -#include -#include -#include - -#include "test_macros.h" - -int main(int, char**) -{ -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L - static_assert((std::is_same::char_type, char8_t>::value), ""); - static_assert((std::is_same::int_type, unsigned int>::value), ""); - static_assert((std::is_same::off_type, std::streamoff>::value), ""); - static_assert((std::is_same::pos_type, std::u8streampos>::value), ""); - static_assert((std::is_same::state_type, std::mbstate_t>::value), ""); - static_assert(std::is_same_v::comparison_category, std::strong_ordering>); -#endif - - return 0; -} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/types.compile.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/types.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/types.compile.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// using char_type = wchar_t; +// using int_type = wint_t; +// using off_type = streamoff; +// using pos_type = streampos; +// using state_type = mbstate_t; +// using comparison_category = strong_ordering; + +// UNSUPPORTED: no-wide-characters + +#include +#include + +#include "test_macros.h" + +static_assert(std::is_same::char_type, wchar_t>::value, ""); +static_assert(std::is_same::int_type, std::wint_t>::value, ""); +static_assert(std::is_same::off_type, std::streamoff>::value, ""); +static_assert(std::is_same::pos_type, std::wstreampos>::value, ""); +static_assert(std::is_same::state_type, std::mbstate_t>::value, ""); +#if TEST_STD_VER > 17 +static_assert(std::is_same_v::comparison_category, std::strong_ordering>); +#endif diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/types.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/types.pass.cpp deleted file mode 100644 --- a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/types.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// - -// template<> struct char_traits - -// typedef wchar_t char_type; -// typedef int int_type; -// typedef streamoff off_type; -// typedef streampos pos_type; -// typedef mbstate_t state_type; -// using comparison_category = strong_ordering; - -// UNSUPPORTED: no-wide-characters - -#include -#include - -#include "test_macros.h" - -int main(int, char**) -{ - static_assert((std::is_same::char_type, wchar_t>::value), ""); - static_assert((std::is_same::int_type, std::wint_t>::value), ""); - static_assert((std::is_same::off_type, std::streamoff>::value), ""); - static_assert((std::is_same::pos_type, std::wstreampos>::value), ""); - static_assert((std::is_same::state_type, std::mbstate_t>::value), ""); -#if TEST_STD_VER > 17 - static_assert(std::is_same_v::comparison_category, std::strong_ordering>); -#endif - - return 0; -}