This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/26181] New: istream::operator>>(streambuf*) fails to set eofbit
- From: "sebor at roguewave dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Feb 2006 21:51:40 -0000
- Subject: [Bug libstdc++/26181] New: istream::operator>>(streambuf*) fails to set eofbit
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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