Yes, strictly, when you use delete[] , the static type of the pointer that you delete[] must match the type of array that you originally allocated, or you will get undefined behavior.
Typically, in many implementations of delete[] , void* is called, which is actually an array of type that does not have a non-trivial destructor, but it is not guaranteed.
delete[] buffer
or
delete[] (char*)something
will be valid.
Charles Bailey
source share