Created on 2001-09-20.00:00:00 last changed 130 months ago
[Moved to DR at the April, 2013 meeting.]
Proposed resolution (February, 2012):
This issue is resolved by the resolution of issue 616.
6.7.5.5.3 [basic.stc.dynamic.deallocation] paragraph 4 mentions that the effect of using an invalid pointer value is undefined. However, the standard never says what it means to 'use' a value.
There are a number of possible interpretations, but it appears that each 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 is clearly 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 24 [containers]) of pointers show undefined behaviour, e.g. 24.3.10.4 [list.modifiers] requires to invoke the destructor as part of the clear() method of the container.
If any other meaning was intended for 'using an expression', that meaning should be stated explicitly.
(See also issue 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 |