I'm having same issue in Ubuntu 10.04 using gcc4.4, the same code works fine on RH 5.5 using gcc4.1
#include <sstream>
#include <iostream>
int main(int argc, char** argv) {
std::stringstream myStream;
myStream << "-123";
unsigned int myUInt;
myStream >> myUInt;
if(myStream.fail()) {
std::cout << "FAILED" << std::endl;
}
}
doesn't give FAILED, I have already found this:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39802
where it stated that it was corrected in gcc4.1, not sure the if that miss behave (unless I'm missing something) is related to same problem.