The standard specifies the behavior of std::basic_filebuf::overflow() as follows: "Behaves according to the description of basic_streambuf<charT, traits>::overflow(c), except that the behavior of “consuming characters” is performed by first converting". The behavior of basic_streambuf<charT, traits>::overflow(c) is specified as follows: "Let r be the number of characters in the pending sequence not consumed. If r is nonzero then pbase() and pptr() are set so that: pptr() - pbase() == r and the r characters starting at pbase() are the associated output stream. In case r is zero (all characters of the pending sequence have been consumed) then either pbase() is set to nullptr, or pbase() and pptr() are both set to the same non-null value". It means that in general the post-condition of this method is (pptr() == pbase()) || (pbase() == nullptr) || (pptr() - pbase() == r). This patch adds this post-condition check and marks other checks as libc++ specific making the test more portable.
BTW, methods pptr(), pbase() and epptr() return pointers, but this test compares their results with zero instead of nullptr. This is also fixed.