------- Comment #4 from jwakely dot gcc at gmail dot com 2009-06-10 10:33 ------- The code is invalid
MyStream:: MyStream () : std::iostream (&m_buf), m_buf () { } m_buf has not been cosntructed when you pass it to the base constructor, so m_buf.init() is called on an uncosntructed streambuf. You shoudl either pass a null pointer to the base class, then call m_buf.init() in the MyStream constructor body, or use the base-from-member idiom to initialise m_buf before the base class. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40391