This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix libstdc++/9507


Pétur Runólfsson wrote:

P.S. The original testcase is really involved compared to the
underlying issue and I would rather prefer not adding it.

It might be easier to test this by deriving a class from std::filebuf
and override seekoff to always return pos_type(off_type(-1)).

Yes, thanks, like this:

class c_fbuf : public basic_filebuf<char>
{
pos_type
seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
{
return pos_type(off_type(-1));
}
};

int main()
{
c_fbuf fbuf;
c_fbuf* r = static_cast<c_fbuf*>(fbuf.open("xxx", ios_base::out | ios_base::ate));
assert(!fbuf.is_open());
assert(r == NULL);
}

however, I didn't notice that all the necessary includes were already
present in filebuf_members.cc and another testcase used the very same
functions. I'm going to post a revised patch including your original testcase.

Ciao, Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]