From 70bba9ef3530b4a45fba1aabe413b56d7b54cc9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Tue, 27 Oct 2020 13:01:54 +0200 Subject: [PATCH] [libcxx] Don't truncate intermediates to wchar_t when widening On windows, wchar_t is 16 bit, while we might be widening chars to char32_t. This cast had been present since the initial commit, and removing it doesn't seem to make any tests fail. Differential Revision: https://reviews.llvm.org/D90228 --- libcxx/include/__locale | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcxx/include/__locale b/libcxx/include/__locale index 48e7b64..90be8bb 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -1412,7 +1412,7 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16> if (__r == codecvt_base::error || __nn == __nb) __throw_runtime_error("locale not supported"); for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s) - *__s = (wchar_t)*__p; + *__s = *__p; __nb = __nn; } return __s; @@ -1446,7 +1446,7 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32> if (__r == codecvt_base::error || __nn == __nb) __throw_runtime_error("locale not supported"); for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s) - *__s = (wchar_t)*__p; + *__s = *__p; __nb = __nn; } return __s; -- 2.7.4