basic_ios default ctorSection: 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::initbefore ...()Doing so, I recommend to adapt that of
ios_base();as well, where we have:Effects: Each
ios_basemember has an indeterminate value after construction. These members shall be initialized by callingbasic_ios::init. If anios_baseobject 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_basemember has an indeterminate value after construction.TheseThe object's members shall be initialized by callingbasic_ios::initbefore the object's first use or before it is destroyed, whichever comes first; otherwise the behavior is undefined..If anios_baseobject 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 callingitsbasic_ios::initbefore its first use or before it is destroyed, whichever comes first; otherwise the behavior is undefined.member function. If it is destroyed before it has been initialized the behavior is undefined.