https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119880
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- I think using fwide that way leads to undefined behaviour though. The C standard says: "Byte input/output functions shall not be applied to a wide-oriented stream and wide character input/output functions shall not be applied to a byte-oriented stream." So once the stdout stream is byte-oriented, using std::wcout is undefined. And once it's wide-oriented, using std::cout is undefined. POSIX is clear: "If the orientation of the stream has already been determined, fwide() shall not change it."