Just to recap: the example code given by the OP invokes undefined behaviour, since the delete is called on a pointer that has not been allocated by new and it is not NULL.