This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.
Section: 31.10[file.streams]Status:CD1Submitter: Ben HutchingsOpened: 2004-04-01Last modified: 2017-06-15
Priority:Not Prioritized
View all otherissues in [file.streams].
View all issues withCD1 status.
Discussion:
The second parameters of the non-default constructor and of the openmember function for basic_fstream, named "mode", are optionalaccording to the class declaration in 27.8.1.11 [lib.fstream]. Thespecifications of these members in 27.8.1.12 [lib.fstream.cons] and27.8.1.13 lib.fstream.members] disagree with this, though theconstructor declaration has the "explicit" function-specifier implyingthat it is intended to be callable with one argument.
Proposed resolution:
In 31.10.6.2[fstream.cons], change
explicit basic_fstream(const char* s, ios_base::openmode mode);
to
explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
In 31.10.6.4[fstream.members], change
void open(const char*s, ios_base::openmode mode);
to
void open(const char*s, ios_base::openmode mode = ios_base::in|ios_base::out);