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

1249. basic_ios default ctor

Section: 31.5.4.2 [basic.ios.cons] Status: C++11 Submitter: Martin Sebor Opened: 2009-10-25 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [basic.ios.cons].

View all issues with C++11 status.

Discussion:

The basic_ios default ctor is required to leave the objects members uninitialized (see below). The paragraph says the object must be initialized by calling basic_ios::init() before it's destroyed but I can't find a requirement that it be initialized before calling any of the class other member functions. Am I not looking in the right place or that an issue?

[ 2009-10-25 Daniel adds: ]

I agree, that your wording makes that clearer, but suggest to write

... calling basic_ios::init() before ...

Doing so, I recommend to adapt that of ios_base(); as well, where we have:

Effects: Each ios_base member has an indeterminate value after construction. These members shall be initialized by calling basic_ios::init. If an ios_base object is destroyed before these initializations have taken place, the behavior is undefined.

[ Post-Rapperswil: ]

Moved to Tentatively Ready after 5 positive votes on c++std-lib.

[ Adopted at 2010-11 Batavia ]

Proposed resolution:

Change 31.5.2.8 [ios.base.cons] p1:

ios_base();

Effects: Each ios_base member has an indeterminate value after construction. These members shall be initialized by calling basic_ios::init . If an ios_base object is destroyed before these initializations have taken place, the behavior is undefined.

Change 31.5.4.2 [basic.ios.cons] p2:

basic_ios();

Effects: Constructs an object of class basic_ios (27.5.2.7) leaving its member objects uninitialized. The object shall be initialized by calling its init member function. If it is destroyed before it has been initialized the behavior is undefined.