http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Which also explains that you can make the inserted characters append to the buffer using std::ios::ate e.g. std::stringstream tmpLabel(std::ios::ate|std::ios::out); or using an ostringstream std::ostringstream tmpLabel(std::ios::out);