https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89452
--- Comment #6 from Baykov Nikita <nknikita at niisi dot ras.ru> --- There is one more issue. ISO/IEC 14882:2017(E) and N4800 specify that seekpos(sp, which) and seekoff(off_type(sp), ios_base::beg, which) should be equivalent, but it seems that they are not equivalent in libstdc++ implementation for GCC. The following code works fine for me: stringbuf sb("abcdefgh", ios_base::in); assert (sb.pubseekoff(3, ios_base::beg, ios_base::in|ios_base::out) == -1); The following code fails: stringbuf sb("abcdefgh", ios_base::in); assert (sb.pubseekpos(3, ios_base::in|ios_base::out) == -1);