* [v3] libstdc++/7220
@ 2002-07-25 17:17 Benjamin Kosnik
0 siblings, 0 replies; only message in thread
From: Benjamin Kosnik @ 2002-07-25 17:17 UTC (permalink / raw)
To: gcc-patches
Regression from gcc-3.0.x.
tested x86/linux
quequed for gcc-3_1-branch
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.
Index: include/bits/istream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/istream.tcc,v
retrieving revision 1.31
diff -c -p -r1.31 istream.tcc
*** include/bits/istream.tcc 7 Jun 2002 22:06:38 -0000 1.31
--- include/bits/istream.tcc 25 Jul 2002 23:19:17 -0000
*************** namespace std
*** 708,714 ****
{
_M_gcount = 0;
sentry __cerb(*this, true);
! if (__cerb)
{
try
{
--- 708,714 ----
{
_M_gcount = 0;
sentry __cerb(*this, true);
! if (__cerb && __n > 0)
{
try
{
Index: testsuite/27_io/istream_unformatted.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/istream_unformatted.cc,v
retrieving revision 1.17
diff -c -p -r1.17 istream_unformatted.cc
*** testsuite/27_io/istream_unformatted.cc 22 Apr 2002 19:10:02 -0000 1.17
--- testsuite/27_io/istream_unformatted.cc 25 Jul 2002 23:19:21 -0000
*************** test09()
*** 514,519 ****
--- 514,556 ----
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()
{
*************** main()
*** 526,531 ****
--- 563,569 ----
test07();
test08();
test09();
+ test10();
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-07-25 23:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-25 17:17 [v3] libstdc++/7220 Benjamin Kosnik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).