Title
effects of a.copyfmt (a)
Status
cd1
Section
[basic.ios.members]
Submitter
Martin Sebor

Created on 2001-01-05.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

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...

Date: 2001-01-05.00:00:00

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.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2133
2001-01-05 00:00:00admincreate