This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/44441] std::getline set failbit in situation when shouldn't
- From: "qwak82 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jun 2010 11:36:08 -0000
- Subject: [Bug libstdc++/44441] std::getline set failbit in situation when shouldn't
- References: <bug-44441-19291@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from qwak82 at gmail dot com 2010-06-07 11:36 -------
But also fail bit, this program prints:
line: a //this is OK, first line
line: //this is also OK, second (empty) line
fail bit //eof is set - OK; but fail bit should be set here?
#include <iostream>
#include <sstream>
int main() {
std::istringstream s("a\n");
while (s.good()) {
std::string line;
std::getline(s, line);
std::cout << "line: " << line << std::endl;
}
if (s.fail()) std::cout << "fail bit";
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44441