[Bug libstdc++/37958] num_get<>::do_get(bool) sets eofbit flag incorrectly when boolalpha == true
tsyvarev at ispras dot ru
gcc-bugzilla@gcc.gnu.org
Thu Nov 6 07:17:00 GMT 2008
------- Comment #19 from tsyvarev at ispras dot ru 2008-11-06 07:16 -------
Created an attachment (id=16627)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16627&action=view)
Analogue of basic_istringstream with (in == end) catching
Using basic_istringstream1 class instead basic_istringstream one can count
symbols, which implementation is really read. These symbols are those, for
which (in == end) or/and (*in) was performed (++in operation does not affect on
this counter).
Test testsuite/22_locale/num_get/get/char/37958.cc may be extend as:
- istringstream iss0, iss1, iss2, iss3;
+ basic_istringstream1<char> iss0, iss1, iss2, iss3;
...
iss0.str("true");
iss0.setf(ios_base::boolalpha);
err = ios_base::goodbit;
end = ng0.get(iss0.rdbuf(), 0, iss0, err, b0);
VERIFY( err == ios_base::goodbit );
VERIFY( b0 == true );
+ VERIFY( iss0.rdbuf()->chars_read() == 4);//after character 'e' (in == end)
should not be performed
iss0.str("false");
iss0.clear();
err = ios_base::goodbit;
end = ng0.get(iss0.rdbuf(), 0, iss0, err, b0);
VERIFY( err == ios_base::goodbit );
VERIFY( b0 == false );
+ VERIFY( iss0.rdbuf()->chars_read() == 5);
...
iss2.str("1");
iss2.setf(ios_base::boolalpha);
err = ios_base::goodbit;
end = ng2.get(iss2.rdbuf(), 0, iss2, err, b2);
VERIFY( err == ios_base::goodbit );
VERIFY( b2 == true );
+ VERIFY( iss2.rdbuf()->chars_read() == 1);
...
iss3.str("");
iss3.clear();
b3 = true;
err = ios_base::goodbit;
end = ng3.get(iss3.rdbuf(), 0, iss3, err, b3);
VERIFY( err == ios_base::failbit );
VERIFY( b3 == false );
+ VERIFY( iss3.rdbuf()->chars_read() == 0);//stream should not be readed at all
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37958
More information about the Gcc-bugs
mailing list