[Patch] Fix libstdc++/9507

Paolo Carlini pcarlini@unitus.it
Sun Feb 2 13:02:00 GMT 2003


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.



More information about the Libstdc++ mailing list