https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42857
--- Comment #6 from Andrew Ayer <bugs at mm dot beanwood.com> --- Any word on if this will be fixed in GCC? To summarize, GCC's current behavior is wrong because: * Underflowing after ignoring the requested number of bytes could block forever, breaking applications. * The standard says "characters are extracted until ANY of the following occurs: ... n characters are extracted" (emphasis mine). If ignore() blocks forever after extracting n characters, it's a violation of the standard because it doesn't terminate as is required. * GCC's std::basic_istream::read() implementation does NOT underflow after reading the requested number of bytes (even though the standard uses similar language for read and ignore). This inconsistent behavior is confusing as one would expect read and ignore to behave equivalently. * Other major C++ implementations don't underflow after ignoring the requested number of bytes. (Thanks, Sergey, for checking this.) I wrote about this in greater depth at [1] and also wrote my own non-member ignore() which I'm using in place of basic_istream::ignore() [2] which others may find useful until this bug is fixed. [1] https://www.agwa.name/blog/post/gccs_implementation_of_basicistreamignore_is_broken [2] https://www.agwa.name/blog/post/gccs_implementation_of_basicistreamignore_is_broken/media/ignore.h