This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++11 status.
basic_ios default ctorSection: 31.5.4.2[basic.ios.cons]Status:C++11Submitter: Martin SeborOpened: 2009-10-25Last modified: 2016-01-28
Priority:Not Prioritized
View all otherissues in [basic.ios.cons].
View all issues withC++11 status.
Discussion:
Thebasic_ios default ctor is required to leave the objects membersuninitialized (see below). The paragraph says the object must beinitialized by callingbasic_ios::init() before it's destroyed butI can't find a requirement that it be initialized before callingany of the class other member functions. Am I not looking in theright 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, wherewe have:Effects: Each
ios_basemember has an indeterminate valueafter construction. These members shall be initialized by callingbasic_ios::init. If anios_baseobject is destroyedbefore these initializations have taken place, the behavior isundefined.
[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 valueafter 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 destroyedbefore these initializations have taken place, the behavior isundefined.
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 beinitialized by callingitsbasic_ios::initbefore its firstuse or before it is destroyed, whichever comes first; otherwise thebehavior is undefined.member function. If it is destroyedbefore it has been initialized the behavior is undefined.