]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/7220 (g++ 3.1: basic_istream::ignore(0,delimiter) issue.)
authorBenjamin Kosnik <bkoz@redhat.com>
Thu, 25 Jul 2002 23:20:49 +0000 (23:20 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 25 Jul 2002 23:20:49 +0000 (23:20 +0000)
2002-07-25  Benjamin Kosnik  <bkoz@redhat.com>

PR libstdc++/7220
* include/bits/istream.tcc (istream::ignore): Don't extract on
zero.
* testsuite/27_io/istream_unformatted.cc (test10): Add.

From-SVN: r55763

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/istream.tcc
libstdc++-v3/testsuite/27_io/istream_unformatted.cc

index d2e5e268078512f4af1b3b58940ccce1c2443c80..b3c52e445f51a46786f1207b734e43ffc811f0fe 100644 (file)
@@ -1,3 +1,10 @@
+2002-07-25  Benjamin Kosnik  <bkoz@redhat.com>
+
+       PR libstdc++/7220
+       * include/bits/istream.tcc (istream::ignore): Don't extract on
+       zero.
+       * testsuite/27_io/istream_unformatted.cc (test10): Add.
+       
 2002-07-25  Benjamin Kosnik  <bkoz@redhat.com>
 
        * testsuite/27_io/ios_base_type.cc: Move to...
index 2658866ec5784c94d993b4d9b2182314d1980b0e..fc0adea69e37c60550bcd4cc8c72d275562b595a 100644 (file)
@@ -708,7 +708,7 @@ namespace std
     {
       _M_gcount = 0;
       sentry __cerb(*this, true);
-      if (__cerb) 
+      if (__cerb && __n > 0
        {
          try 
            {
index da2cdeb739ed12c5c2685f67975ae2c4faf74f11..0e98dced1082028b08cc92cd1fc758fedfd001e3 100644 (file)
@@ -514,6 +514,43 @@ test09()
   VERIFY( test );
 }
 
+// libstdc++/70220
+void
+test10()
+{
+  using namespace std;
+  bool test = true;
+  typedef string string_type;
+  typedef stringbuf stringbuf_type;
+  typedef istream istream_type;
+
+  int res = 0;
+  streamsize n;
+  string_type  input("abcdefg\n");
+  stringbuf_type sbuf(input);
+  istream_type  istr(&sbuf);
+  
+  istr.ignore(0);
+  if (istr.gcount() != 0) 
+    test = false;
+  VERIFY( test );
+  
+  istr.ignore(0, 'b');
+  if (istr.gcount() != 0) 
+    test = false;
+  VERIFY( test );
+  
+  istr.ignore();       // Advance to next position.
+  istr.ignore(0, 'b');
+  if ((n=istr.gcount()) != 0) 
+    test = false;
+  VERIFY( test );
+  
+  if (istr.peek() != 'b')
+    test = false;
+  VERIFY( test );
+}
+
 int 
 main()
 {
@@ -526,6 +563,7 @@ main()
   test07();
   test08();
   test09();
+  test10();
 
   return 0;
 }