I have the following operator delete
replacements:
void operator delete[](void* p)
{
/* Implementation does not matter. */
}
void operator delete[](void* p, std::size_t size)
{
/* Implementation does not matter. */
}
My question is why, in the following code, GCC 6.2 calls void operator delete[](void*)
and not the second replacement:
char* str = new char[14];
delete[] str;
According to 5.3.5 Delete [expr.delete]:
(10.3) If the type is complete and if, for the second alternative (delete array) only, the operand is a pointer to a class type with a non-trivial destructor or a (possibly multi-dimensional) array thereof, the function with a parameter of type std::size_t is selected.
Therefore, I believe operator delete[](void*, std::size_t)
must be called, doesn't it?