The following example is based on one from The D Programming Language. I'd 
expect the last assertion in
the unittest to succeed, it fails.

class Buffer {
        private void* data;

        // Constructor
        this () {
                data = malloc(1024);
        }
        // Destructor
        ~this() {
                free(data);
                data = null;
        }
}
unittest {
        auto b = new Buffer;
        auto b1 = b;
        clear(b);                               // Get rid of b's extra state
        assert (b1.data is null);       // Should be ok, fails
}

Reply via email to