Doing this:
union{
int * integer;
char * character;
} u;
u.integer = new int;
delete u.character;
u.integer = new int[5];
delete [] u.character;
I assume this wouldn’t work if any of these types have non trivial destructors, but is this ok?
This doesn’t work in any case, if we assume work means having well-defined behavior rather than appearing to work (i.e. not crashing)