460. Default modes missing from basic_fstream member specifications

Section: 31.10 [file.streams] Status: CD1 Submitter: Ben Hutchings Opened: 2004-04-01 Last modified: 2017-06-15 20:26:45 UTC

Priority: Not Prioritized

View all other issues in [file.streams].

View all issues with CD1 status.


The second parameters of the non-default constructor and of the open member function for basic_fstream, named "mode", are optional according to the class declaration in [lib.fstream]. The specifications of these members in [lib.fstream.cons] and lib.fstream.members] disagree with this, though the constructor declaration has the "explicit" function-specifier implying that it is intended to be callable with one argument.

Proposed resolution:

In [fstream.cons], change

  explicit basic_fstream(const char* s, ios_base::openmode mode); 


  explicit basic_fstream(const char* s,
                         ios_base::openmode mode = ios_base::in|ios_base::out);

In [fstream.members], change

  void open(const char*s, ios_base::openmode mode); 


  void open(const char*s,
            ios_base::openmode mode = ios_base::in|ios_base::out);