This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Editorial status.
Section: 18.104.22.168.3 [ostream::sentry] Status: NAD Editorial Submitter: Martin Sebor Opened: 2003-01-05 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [ostream::sentry].
View all issues with NAD Editorial status.
22.214.171.124, p3 prohibits library dtors from throwing exceptions.
126.96.36.199, p4 says this about the ostream::sentry dtor:
-4- If ((os.flags() & ios_base::unitbuf) && !uncaught_exception()) is true, calls os.flush().
188.8.131.52, p7 that describes ostream::flush() says:
-7- If rdbuf() is not a null pointer, calls rdbuf()->pubsync(). If that function returns ?-1 calls setstate(badbit) (which may throw ios_base::failure (184.108.40.206)).
That seems like a defect, since both pubsync() and setstate() can throw an exception.
[ The contradiction is real. Clause 17 says destructors may never throw exceptions, and clause 27 specifies a destructor that does throw. In principle we might change either one. We're leaning toward changing clause 17: putting in an "unless otherwise specified" clause, and then putting in a footnote saying the sentry destructor is the only one that can throw. PJP suggests specifying that sentry::~sentry() should internally catch any exceptions it might cause. ]
[ See 418 and 622 for related issues. ]
[ 2009-07 Frankfurt ]
Move to Review. Add "Throws: nothing" to the specification of ostream::sentry::~sentry().
[ 2009-10-13 Daniel adds: ]
The proposed resolution of 835 is written to match the outcome of this issue.
[ 2009 Santa Cruz: ]
Move to Open. Our intent is to solve this issue with 835.
[ 2010-03-06 Martin updates wording. ]
[ 2010 Pittsburgh: ]
Moved to NAD Editorial.
Solved by 835.
Add after 220.127.116.11.3 [ostream::sentry] p17:
-17- If (os.flags() & ios_base::unitbuf) is true, calls os.flush().