Created on 2007-02-27.00:00:00 last changed 77 months ago
Additional note, February, 2014:
This issue was resolved by the resolution of issue 616, which made use of a pointer to deleted storage implementation-defined behavior.
Rationale (April, 2007):
The current specification is clear and was well-motivated. Analysis of whether this restriction is still needed should be done via a paper and discussed in the Evolution Working Group rather than being handled by CWG as an issue/defect.
Any use of a pointer to deleted storage, even if the pointer is not dereferenced, produces undefined behavior (184.108.40.206 [basic.stc.dynamic.deallocation] paragraph 4). The reason for this restriction is that, on some historical architectures, deallocating an object might free a memory segment, resulting in a hardware exception if a pointer referring to that segment were loaded into a pointer register, and on those architectures use of a pointer register for moving and comparing pointers was the most efficient mechanism for these operations.
It is not clear whether current or foreseeable architectures still require such a draconian restriction or whether it is feasible to relax it only to forbid a smaller range of operations. Of particular concern is the use of atomic pointers, which might be used in race conditions involving deallocation, where the loser of the race might encounter this undefined behavior.
(See also issue 312.)
|2014-03-03 00:00:00||admin||set||messages: + msg4971|
|2014-03-03 00:00:00||admin||set||status: extension -> cd3|
|2007-05-06 00:00:00||admin||set||messages: + msg1511|
|2007-05-06 00:00:00||admin||set||status: open -> extension|