http://llvm.org/bugs/show_bug.cgi?id=19497
Bug ID: 19497
Summary: std::ws sets failbit at eof
Product: libc++
Version: 3.3
Hardware: PC
OS: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
When porting an application recently, I discovered that std::ws sets the
failbit if it is called when eofbit is set. This differs from the libstdc++
behaviour and there's a StackOverflow mention of it here:
http://stackoverflow.com/questions/13423514/should-stdws-raise-failbit-at-end-of-file
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char **argv)
{
int i;
stringstream s("0");
s >> i >> std::ws;
cout << "eof: " << s.eof() << " fail: " << s.fail() << "\n";
return 0;
}
Output (c++ is FreeBSD Clang 3.3 and g++47 is GNU C++ 4.7):
> c++ test.cpp
> ./a.out
eof: 1 fail: 1
> g++47 test.cpp
> ./a.out
eof: 1 fail: 0
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs