[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
This commit is contained in:
Martin Storsjö 2020-10-27 13:01:54 +02:00
parent 5459d08795
commit 70bba9ef35
1 changed files with 2 additions and 2 deletions

View File

@ -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;