This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 31.5.4.3 [basic.ios.members] Status: CD1 Submitter: Martin Sebor Opened: 2001-01-05 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [basic.ios.members].
View all issues with CD1 status.
Discussion:
The Effects clause of the member function copyfmt() in 27.4.4.2, p15 doesn't consider the case where the left-hand side argument is identical to the argument on the right-hand side, that is (this == &rhs). If the two arguments are identical there is no need to copy any of the data members or call any callbacks registered with register_callback(). Also, as Howard Hinnant points out in message c++std-lib-8149 it appears to be incorrect to allow the object to fire erase_event followed by copyfmt_event since the callback handling the latter event may 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 *this the corresponding member objects of rhs, except that...
to
-15- Effects:If (this == &rhs) does nothing. Otherwise assigns to the member objects of *this the corresponding member objects of rhs, except that...