As usual in C ++ Standard, when nothing is specified explicitly, violation of the requirements leads to undefined behavior. It should always be a requirement, not an option in the C ++ standard.
For example, here MSDN says :
The _Ptr pointer must be previously returned by a call to highlight for the allocator object, which is compared to * this, highlighting an array object of the same size and type.
which means that the size must match exactly, otherwise you will encounter undefined behavior.
source share