https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69608
Bug ID: 69608 Summary: strsteambuf copy ctor and assignment inaccessible Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- As far as I can see, the C++ standard doesn't prevent the copying of strstreambuf objects. With the resolution of issue 421 these copies should have (almost) well-defined semantics. But the following program fails to compile with the latest libstdc++. That said, I'm not sure it's a good idea for the standard to require implementations to accept the program. If it did, it seems that the two copies would share the same underlying character buffer (courtesy of issue 421). Accessing the buffer in the copy would be undefined after the copied strstreambuf object was destroyed. If this hasn't been discussed in LWG yet it might be worth bringing it up. strstreambuf may be deprecated but the same concern applies to similar user-defined classes that publicly derive from basic_streambuf and expose an accsible copy ctor or assignment operator of their own. $ cat t.cpp && /home/msebor/build/gcc-trunk-bootstrap/gcc/xg++ -B/home/msebor/build/gcc-trunk-bootstrap/gcc -S ... t.cpp #include <strstream> int main () { std::strstreambuf a; a = std::strstreambuf (32); } In file included from /src/gcc/trunk/libstdc++-v3/include/backward/strstream:50:0, from t.cpp:1: /src/gcc/trunk/libstdc++-v3/include/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp] t.cpp: In function ‘int main()’: t.cpp:6:30: error: ‘std::strstreambuf& std::strstreambuf::operator=(const std::strstreambuf&)’ is private within this context In file included from t.cpp:1:0: /src/gcc/trunk/libstdc++-v3/include/backward/strstream:102:5: note: declared private here