This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/44441] std::getline set failbit in situation when shouldn't



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]