https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37475
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- Whereas the GNU locale has that check inside a loop, which is never entered when the destination buffer is zero sized, i.e. __to == __to_end if (__from_next < __from_end && __ret == ok) { if (__to_next < __to_end) { // XXX Probably wrong for stateful encodings __tmp_state = __state; ++__from_next; *__to_next++ = L'\0'; } else __ret = partial; }