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.5.4.3[basic.ios.members]Status:CD1Submitter: Martin SeborOpened: 2001-01-05Last modified: 2016-01-28
Priority:Not Prioritized
View all otherissues in [basic.ios.members].
View all issues withCD1 status.
Discussion:
The Effects clause of the member functioncopyfmt() in27.4.4.2, p15 doesn't consider the case where the left-hand sideargument is identical to the argument on the right-hand side, that is(this == &rhs). If the two arguments are identical thereis no need to copy any of the data members or call any callbacksregistered withregister_callback(). Also, as Howard Hinnantpoints out in message c++std-lib-8149 it appears to be incorrect toallow the object to fireerase_event followed bycopyfmt_event since the callback handling the latter eventmay inadvertently attempt to access memory freed by the former.
Proposed resolution:
Change the Effects clause in 27.4.4.2, p15 from
-15- Effects:Assigns to the member objects of
*thisthe corresponding member objects ofrhs, except that...
to
-15- Effects:If
(this == &rhs)does nothing. Otherwiseassigns to the member objects of*thisthe corresponding memberobjects ofrhs, except that...