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.

### 592. Incorrect treatment of rdbuf()->close() return type

Section: 29.10.3.4 [ifstream.members] Status: NAD Editorial Submitter: Christopher Kohlhoff Opened: 2006-08-17 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [ifstream.members].

View all issues with NAD Editorial status.

Discussion:

I just spotted a minor problem in 27.8.1.7 [lib.ifstream.members] para 4 and also 27.8.1.13 [lib.fstream.members] para 4. In both places it says:

>     void close();

> Effects: Calls rdbuf()->close() and, if that function returns false, ...

However, basic_filebuf::close() (27.8.1.2) returns a pointer to the filebuf on success, null on failure, so I think it is meant to say "if that function returns a null pointer". Oddly, it is correct for basic_ofstream.

Proposed resolution:

Change 29.10.3.4 [ifstream.members], p5:

> Effects: Calls `rdbuf()->close()` and, if that function fails (returns `false` a null pointer), calls `setstate(failbit)` (which may throw `ios_base::failure` (27.4.4.3)).

Change 29.10.5.4 [fstream.members], p5:

> Effects: Calls `rdbuf()->close()` and, if that function fails (returns `false` a null pointer), calls `setstate(failbit)` (which may throw `ios_base::failure` (27.4.4.3)).

[ Kona (2007): Proposed Disposition: NAD, Editorial ]