https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79511
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> --- And this is the fix for comment 3: --- a/libstdc++-v3/src/c++11/codecvt.cc +++ b/libstdc++-v3/src/c++11/codecvt.cc @@ -315,7 +315,7 @@ namespace { static_assert(sizeof(C) >= 2, "a code unit must be at least 16-bit"); - if (codepoint < max_single_utf16_unit) + if (codepoint <= max_single_utf16_unit) { if (to.size() > 0) {