[Bug libstdc++/26181] New: istream::operator>>(streambuf*) fails to set eofbit
sebor at roguewave dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 8 21:51:00 GMT 2006
The program below is expected to run successfully to completion.
The extractor must set eofbit even though doing so is not explicitly specified
in 27.6.1.2.3, p12, since it is specified by the blanket statement in 27.6.1.1,
p3.
$ cat t.cpp && g++ -dumpversion && g++ t.cpp -static && ./a.out
#include <cassert>
#include <fstream>
#include <sstream>
int main ()
{
std::ifstream ifs (__FILE__);
std::stringstream ss;
assert (0 == ifs.tellg ());
ifs >> ss.rdbuf ();
assert (ifs.eofbit == ifs.rdstate ());
assert (-1 == ifs.tellg ());
ifs.clear ();
assert (0 < ifs.tellg ());
ifs.get ();
assert (-1 == ifs.tellg ());
}
4.0.2
Assertion failed: ifs.eofbit == ifs.rdstate (), file t.cpp, line 14
Abort (core dumped)
This first came up here:
http://forum.sun.com/thread.jspa?threadID=28814
--
Summary: istream::operator>>(streambuf*) fails to set eofbit
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sebor at roguewave dot com
GCC build triplet: all
GCC host triplet: all
GCC target triplet: all
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26181
More information about the Gcc-bugs
mailing list