Created on2001-09-20.00:00:00 last changed145 months ago
[Moved to DR at the April, 2013 meeting.]
Proposed resolution (February, 2012):
This issue is resolved by the resolution ofissue 616.
6.8.6.5.3 [basic.stc.dynamic.deallocation] paragraph 4 mentions that the effectof using an invalid pointer value is undefined. However, the standardnever says what it means to 'use' a value.
There are a number of possible interpretations, but it appears thateach of them leads to undesired conclusions:
int *x = new int(0); delete x; x = 0;into undefined behaviour. As this is a common idiom, this isclearly undesirable.
int *x = new int(0); delete x; x->~int();into undefined behaviour; according to _N4778_.7.6.1.4 [expr.pseudo],the variable x is'evaluated' as part of evaluating the pseudo destructor call. This,in turn, would mean that all containers (Clause 23 [containers])of pointers showundefined behaviour, e.g. 23.3.11.4 [list.modifiers]requires to invoke thedestructor as part of theclear() method of the container.
If any other meaning was intended for 'using an expression', thatmeaning should be stated explicitly.
(See alsoissue 623.)
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
| 2013-10-14 00:00:00 | admin | set | status: dr -> drwp |
| 2013-05-03 00:00:00 | admin | set | messages: +msg4372 |
| 2013-05-03 00:00:00 | admin | set | status: ready -> dr |
| 2012-02-27 00:00:00 | admin | set | status: review -> ready |
| 2011-09-06 00:00:00 | admin | set | messages: +msg3498 |
| 2011-09-06 00:00:00 | admin | set | status: open -> review |
| 2001-09-20 00:00:00 | admin | create | |