This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] libstdc++/6648
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: libstdc++ at gcc dot gnu dot org, bkoz <bkoz at redhat dot com>, schmid at snake dot iap dot physik dot tu-darmstadt dot de
- Date: Tue, 14 May 2002 00:50:02 +0200
- Subject: Re: [PATCH] libstdc++/6648
- References: <3CE02E10.40502@unitus.it> <3CE03E49.6040002@unitus.it>
Paolo Carlini wrote:
> On second thought, I'm not quite happy with the testcase.
Well, sorry, but even the second try it's not really ok, since the
second input (that corresponding to istream::ignore) does not expose the
bug if carried out after the istream::getline one. Therefore I'd rather
prefer the following.
Sorry again for the confusion (I'm a bit tired)
Paolo.
//////////////
diff -urN libstdc++-v3-orig/include/bits/istream.tcc
libstdc++-v3/include/bits/istream.tcc
--- libstdc++-v3-orig/include/bits/istream.tcc 2002-04-22
21:10:01.000000000 +0200
+++ libstdc++-v3/include/bits/istream.tcc 2002-05-13
22:32:43.000000000 +0200
@@ -679,7 +679,7 @@
{
if (__c == __idelim)
{
- __sb->snextc();
+ __sb->sbumpc();
++_M_gcount;
}
else
@@ -726,7 +726,7 @@
this->setstate(ios_base::eofbit);
else if (__c == __delim)
{
- __sb->snextc();
+ __sb->sbumpc();
++_M_gcount;
}
}
diff -urN libstdc++-v3-orig/testsuite/27_io/narrow_stream_objects.cc
libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc
--- libstdc++-v3-orig/testsuite/27_io/narrow_stream_objects.cc
2002-05-03 20:22:58.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/narrow_stream_objects.cc 2002-05-14
00:47:49.000000000 +0200
@@ -175,6 +175,24 @@
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;
+ char buff[2048];
+ std::cout << "Enter another name: ";
+ std::cin.ignore(2048, '\n');
+}
+
int
main()
{
@@ -186,5 +204,7 @@
// test05();
// test06();
// test07();
+ // test08();
+ // test09();
return 0;
}