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: 126.96.36.199 [string.io] Status: TC1 Submitter: Scott Snyder Opened: 2000-02-04 Last modified: 2016-12-23
Priority: Not Prioritized
View all other issues in [string.io].
View all issues with TC1 status.
The description of the stream extraction operator for std::string (section 188.8.131.52 [lib.string.io]) does not contain a requirement that failbit be set in the case that the operator fails to extract any characters from the input stream.
This implies that the typical construction
std::istream is; std::string str; ... while (is >> str) ... ;
(which tests failbit) is not required to terminate at EOF.
Furthermore, this is inconsistent with other extraction operators, which do include this requirement. (See sections 184.108.40.206 [istream.formatted] and 220.127.116.11 [istream.unformatted]), where this requirement is present, either explicitly or implicitly, for the extraction operators. It is also present explicitly in the description of getline (istream&, string&, charT) in section 18.104.22.168 [string.io] paragraph 8.)
Insert new paragraph after paragraph 2 in section 22.214.171.124 [string.io]:
If the function extracts no characters, it calls is.setstate(ios::failbit) which may throw ios_base::failure (126.96.36.199).