https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80676
Bug ID: 80676 Summary: basic_stringbuf does not use initial capacity of SSO string Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- The following prints "overflow": #include <sstream> #include <iostream> struct SB : std::stringbuf { int_type overflow(int_type c) override { std::cout << "overflow\n"; return std::stringbuf::overflow(c); } }; int main() { SB sb; std::ostringstream s; s.std::ios::rdbuf(&sb); s.put('a'); } The call to the virtual function should not be necessary when using the new ABI, because the SSO string has an initial non-zero capacity. The stringbuf could use it.