Bug#436175: streambuf inheritance problem.
Package: g++
Version: 4.1.3 20070718 (prerelease)
Creating two classes that inherit from std::ostream and std::streambuf.
When used with setw and characters:
child << "some text" << std::setw(4) << "!";
only ever stores "some text"
However numerics work:
child << "some text" << std::setw(4) << "1";
stores the desired "some text 1"
The child class code as written works perfectly in earlier g++ versions,
but fails in 4.1.3+ and 4.2.1+ (both the latest prereleases)
I have experimented by implementing every possible innheritable function
of both ostream and streambuf that I could find. None of the
un-implemented methods appears to be ever called.
The classes as written are:
class StoreEntryStream : public std::ostream
{
public:
StoreEntryStream(StoreEntry *anEntry) : std::ostream(&_buffer),
_buffer(anEntry) { this->init(&_buffer);}
private:
StoreEntryStreamBuf _buffer;
public:
StoreEntryStreamBuf * rdbuf() const;
};
Reply to: