12297 – istream::sentry::sentry() handles eof() incorrectly. (original) (raw)

Description Pétur Runólfsson 2003-09-16 08:36:24 UTC

According to the resolution to DR 195:

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#195

basic_istream::sentry::sentry() should call setstate(failbit | eofbit) if is.rdbuf()->sgetc() or is.rdbuf()->sbumpc() return eof(). Currently, the sentry constructor calls is.setstate(eofbit) and later calls is.setstate(failbit). This means that failbit will not be set in is.rdstate() as it should if the call to setstate(eofbit) throws an exception.

Comment 2 Drea Pinski 2003-09-28 20:59:42 UTC

I can confirm this on the mainline (20030925).

Comment 5 Drea Pinski 2003-11-26 22:57:05 UTC

Fixed for 3.3.3.