$ cat iss.cpp #include <iostream> #include <sstream> #include <cassert>
int main() { std::istringstream is; std::string s; is.str( std::string( "1" ) ); std::cout << is.str() << std::endl; is >> s; std::cout << s << std::endl; assert( s == "1" ); is.str( std::string( "2" ) ); std::cout << is.str() << std::endl; is >> s; std::cout << s << std::endl; assert( s == "2 "); } $ g++ iss.cpp -Wall -o iss && ./iss 1 1 2 1 iss: iss.cpp:20: int main(): Assertion `s == "2 "' failed. Aborted -- Summary: operator >> loads wrong value after istringsstream::str( string ). Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32608