https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108976
--- Comment #2 from Dimitrij Mijoski <dmjpp at hotmail dot com> --- (In reply to Dimitrij Mijoski from comment #0) > Those that read from UCS-2 seem to me like they properly report the error. > Reading from UTF-16 can not have this bug by definition. From what I > checked, the functions for reading UTF-16 properly treat unpaired surrogate > code units as error. Seems like the conversion from UCS-2 to UTF-16BE/LE is also affected. This conversions is called via codecvt_utf16<char16_t>::out(). See line https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/src/c%2B%2B11/codecvt.cc;h=02f05752de84139a7eb7c3d40946b61f4c0334cf;hb=HEAD#l656 it only checks for high surrogate but should also check for low.