Index: libcxx/trunk/src/strstream.cpp =================================================================== --- libcxx/trunk/src/strstream.cpp +++ libcxx/trunk/src/strstream.cpp @@ -175,7 +175,6 @@ ptrdiff_t ninp = gptr() - eback(); ptrdiff_t einp = egptr() - eback(); ptrdiff_t nout = pptr() - pbase(); - ptrdiff_t eout = epptr() - pbase(); if (__strmode_ & __allocated) { if (__pfree_) @@ -184,7 +183,7 @@ delete [] eback(); } setg(buf, buf + ninp, buf + einp); - setp(buf + einp, buf + einp + eout); + setp(buf + einp, buf + new_size); pbump(static_cast(nout)); __strmode_ |= __allocated; } Index: libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp =================================================================== --- libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp +++ libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class strstreambuf + +// int overflow(int c); + +#include +#include +#include + +int main(int, char const **argv) { + std::ostrstream oss; + std::string s; + + for (int i = 0; i < 4096; ++i) + s.push_back((i % 16) + 'a'); + + oss << s << std::ends; + std::cout << oss.str(); + oss.freeze(false); + + return 0; +}