This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TC1 status.
Section: 22.214.171.124 [istream.unformatted] Status: TC1 Submitter: Matt Austern Opened: 1998-08-06 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [istream.unformatted].
View all issues with TC1 status.
The introduction to the section on unformatted input (126.96.36.199) says that every unformatted input function catches all exceptions that were thrown during input, sets badbit, and then conditionally rethrows the exception. That seems clear enough. Several of the specific functions, however, such as get() and read(), are documented in some circumstances as setting eofbit and/or failbit. (The standard notes, correctly, that setting eofbit or failbit can sometimes result in an exception being thrown.) The question: if one of these functions throws an exception triggered by setting failbit, is this an exception "thrown during input" and hence covered by 188.8.131.52, or does 184.108.40.206 only refer to a limited class of exceptions? Just to make this concrete, suppose you have the following snippet.
char buffer[N]; istream is; ... is.exceptions(istream::failbit); // Throw on failbit but not on badbit. is.read(buffer, N);
Now suppose we reach EOF before we've read N characters. What iostate bits can we expect to be set, and what exception (if any) will be thrown?
In 220.127.116.11, paragraph 1, after the sentence that begins "If an exception is thrown...", add the following parenthetical comment: "(Exceptions thrown from basic_ios<>::clear() are not caught or rethrown.)"
The LWG looked to two alternative wordings, and choose the proposed resolution as better standardese.