[Bug libstdc++/79511] Convertation issues in std::codecvt_utf8_utf16

mikhail at pilin dot name gcc-bugzilla@gcc.gnu.org
Tue Feb 14 17:18:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79511

--- Comment #3 from ww898 <mikhail at pilin dot name> ---
Repro:

std::wstring_convert<std::codecvt_utf8_utf16<wchar_t, 0x10ffffUL,
std::little_endian>> _Conv;

std::string _Src("\xEF\xBF\xBF");
auto const _Dst = _Conv.from_bytes(&*_Src.begin(), &*_Src.end());
if (_Dst.size() == 2)
  std::cout << std::hex << (unsigned)_Dst[0] << ":" << (unsigned)_Dst[1] <<
std::endl;
else
  std::cout << std::hex << (unsigned)_Dst[0] << std::endl;

Error is when _Dst.size() == 2.


More information about the Gcc-bugs mailing list