Commit 325fceb3 by Benjamin Kosnik Committed by Benjamin Kosnik

re PR libstdc++/7220 (g++ 3.1: basic_istream::ignore(0,delimiter) issue.)

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
parent e179e7d7
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...
* testsuite/27_io/ios_base_types.cc: ...here.
......
......@@ -708,7 +708,7 @@ namespace std
{
_M_gcount = 0;
sentry __cerb(*this, true);
if (__cerb)
if (__cerb && __n > 0)
{
try
{
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment