https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108561

--- Comment #3 from lavr at ncbi dot nlm.nih.gov ---
Also, the standard seems to mention that flush() is an "unformatted output
function", meaning it is supposed to build and check a sentry object (which in
case of a bad stream, would fail, so it's not going to proceed with pubsync()).
 In GCC implementation, the sentry is not constructed, and the comment in the
source code seems to contradict with the standard:

      // basic_ostream::flush() is *not* an unformatted output function.
      ios_base::iostate __err = ios_base::goodbit;
      __try
        {
          if (this->rdbuf() && this->rdbuf()->pubsync() == -1)
            __err |= ios_base::badbit;
        }

If the flush() implementation followed the standard, then the implementation of
endl could be left alone (unconditional chained flush).

Reply via email to