This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

### 399. volations of unformatted input function requirements

Section: 31.7.5.4 [istream.unformatted] Status: NAD Submitter: Martin Sebor Opened: 2003-01-05 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [istream.unformatted].

View all issues with NAD status.

Discussion:

The Effects clauses for the two functions below violate the general requirements on unformatted input functions outlined in 27.6.1.3: they do not begin by constructing a sentry object. Instead, they begin by calling widen ('\n'), which may throw an exception. The exception is then allowed to propagate from the unformatted input function irrespective of the setting of exceptions().

Note that in light of 27.6.1.1, p3 and p4, the fact that the functions allow exceptions thrown from widen() to propagate may not strictly speaking be a defect (but the fact that the functions do not start by constructing a sentry object still is). However, since an exception thrown from ctype<charT> ::widen() during any other input operation (say, from within a call to num_get<charT>::get()) will be caught and cause badbit to be set, these two functions should not be treated differently for the sake of consistency.

Proposed resolution:

Rationale:

Not a defect. The standard is consistent, and the behavior required by the standard is unambiguous. Yes, it's theoretically possible for widen to throw. (Not that this will happen for the default ctype facet or for most real-world replacement ctype facets.) Users who define ctype facets that can throw, and who care about this behavior, can use alternative signatures that don't call widen.