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:29:29 +0200
- Subject: Re: [PATCH] libstdc++/6648
- References: <3CE02E10.40502@unitus.it>
> 2002-05-13 Paolo Carlini <pcarlini@unitus.it>
>
> PR libstdc++/6648
> * include/bits/istream.tcc (getline, ignore):
> Upon __idelim (__delim) call sbumpc() not snextc().
> * testsuite/27_io/narrow_stream_object.cc: Add test08.
On second thought, I'm not quite happy with the testcase.
Please consider the following instead.
Ciao again,
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:20:42.000000000 +0200
@@ -175,6 +175,18 @@
VERIFY( s == "test" );
}
+// libstdc++/6648
+// Interactive test: each input must terminate upon a single '\n'.
+void test08()
+{
+ bool test = true;
+ char buff[2048];
+ std::cout << "Enter name: ";
+ std::cin.getline(buff, 2048);
+ std::cout << "Enter second name: ";
+ std::cin.ignore(2048, '\n');
+}
+
int
main()
{
@@ -186,5 +198,6 @@
// test05();
// test06();
// test07();
+ // test08();
return 0;
}