llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

sync() not setting rdstate on certain errors

Open edfvogel opened this issue 5 years ago • 0 comments

Bugzilla Link 52157
Version 11.0
OS All
CC @mclow

Extended Description

The code in istream that implements sync contains:

        if (this->rdbuf()->pubsync() == -1)
        {
            __state |= ios_base::badbit;
            return -1;
        }

I believe this is wrong. There needs to be a call to:

    this->setstate(__state);

before the return. Older versions got this right.

Not a bad problem, but I thought I'd report it.

Thank you,

Ed Vogel

edfvogel avatar Oct 12 '21 19:10 edfvogel