[Bug middle-end/40391] Segfault with -O, iostream, anonymous namespace on PPC
jwakely dot gcc at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 10 10:33:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list