http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273
Bug ID: 57273 Summary: stringstream str initialization fails Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ycollette.nospam at free dot fr It tried to initialize the content of a stringstream using the following code: std::stringstream tmpLabel; tmpLabel.str("test "); tmpLabel << 1; And the result fails. I've got on screen: '1est' instead of 'test 1'. The workaround: std::stringstream tmpLabel; tmpLabel.str(""); tmpLabel << "test " << 1; Here is a test file: #include <iostream> #include <sstream> int main() { std::stringstream tmp; tmp.str("test\0"); tmp << 1; std::cout << "result = |" << tmp.str() << "|" << std::endl; tmp.str(""); tmp << "test " << 1; std::cout << "result = |" << tmp.str() << "|" << std::endl; return 0; }