https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84367
Bug ID: 84367 Summary: [C++11] std::ostringstream stops inserting after multiple call to move assignment operator Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ftingaud at gmail dot com Target Milestone: --- The following code asserts after a few iterations, because oss is no longer inserting when calling operator<<. Replacing the move assignment by a clear + str("") works. #include <sstream> #include <cassert> int main() { std::ostringstream oss; for (int i = 0; i < 100; ++i) { oss << "abc"; assert(oss.str() == "abc"); oss = std::ostringstream(); } return 0; }