https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93672

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So maybe:

--- a/libstdc++-v3/src/c++98/istream.cc
+++ b/libstdc++-v3/src/c++98/istream.cc
@@ -112,7 +112,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     basic_istream<char>::
     ignore(streamsize __n, int_type __delim)
     {
-      if (traits_type::eq_int_type(__delim, traits_type::eof()))
+      // If __delim is eof() we ignore up to __n chars, and for any other
+      // negative value using eq_int_type(sgetc(), __delim) will never be
true,
+      // so just treat all negative __delim values as eof().
+      if (__delim < 0)
        return ignore(__n);

       _M_gcount = 0;

Reply via email to