]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/6648 (Problems with cin.getline (interactive))
authorPaolo Carlini <pcarlini@unitus.it>
Fri, 17 May 2002 11:43:43 +0000 (13:43 +0200)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 17 May 2002 11:43:43 +0000 (11:43 +0000)
2002-05-15  Paolo Carlini  <pcarlini@unitus.it>

PR libstdc++/6648
* include/bits/istream.tcc (istream::getline, ignore):
Upon __idelim (__delim) call sbumpc() not snextc().
* testsuite/27_io/narrow_stream_objects.cc:
Add test08 and test09.

From-SVN: r53557

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

index 6727390f3efbf94b5b94559c8d79d69066887b19..8c9169457d64437964a9e012b34c2ce0684ef590 100644 (file)
@@ -3,6 +3,14 @@
        * docs/html/faq/index.html:  Update not-a-bug list with basic_file.h.
        * docs/html/faq/index.txt:  Regenerate.
 
+2002-05-15  Paolo Carlini  <pcarlini@unitus.it>
+
+       PR libstdc++/6648
+       * include/bits/istream.tcc (istream::getline, ignore):
+       Upon __idelim (__delim) call sbumpc() not snextc().
+       * testsuite/27_io/narrow_stream_objects.cc:
+       Add test08 and test09.
+       
 2002-05-14  Release Manager
 
        * GCC 3.1 Released.
index 636a73863598d45d731b34e49d15f959a6c5aef5..f7f8d6977891880e4aedf38b8d2833c95216c7df 100644 (file)
@@ -679,7 +679,7 @@ namespace std
                {
                  if (__c == __idelim)
                    {
-                     __sb->snextc();
+                     __sb->sbumpc();
                      ++_M_gcount;
                    }
                  else
@@ -726,7 +726,7 @@ namespace std
                this->setstate(ios_base::eofbit);
              else if (__c == __delim)
                {
-                 __sb->snextc();
+                 __sb->sbumpc();
                  ++_M_gcount;
                }
            }
index 016a982c8efc221adc1aa16d7df666570015849e..f767b7248713a6f0016c62d78d69034855b05549 100644 (file)
@@ -175,6 +175,23 @@ void test07()
   VERIFY( s == "test" );
 }
 
+// libstdc++/6648
+// Interactive tests: each one (run alone) must terminate upon a single '\n'.
+void test08()
+{
+  bool test = true;
+  char buff[2048];
+  std::cout << "Enter name: ";
+  std::cin.getline(buff, 2048);
+}
+
+void test09()
+{
+  bool test = true;
+  std::cout << "Enter name: ";
+  std::cin.ignore(2048, '\n');
+}
+
 int 
 main()
 {
@@ -186,5 +203,7 @@ main()
   // test05();
   // test06();
   // test07();
+  // test08();
+  // test09();
   return 0;
 }