I've been trying to understand the following behavior:
#include <iostream>
#include <cstdlib>
using namespace std;
struct A
{
void operator delete[](void *p)
{
cout << "delete\n";
::operator delete[](p);
}
void operator delete[](void *p, size_t t)
{
cout << "delete with two arguments\n";
::operator delete[](p);
}
};
int main()
{
A *a = new A[5];
delete [] a;
}
In the example non-placement deallocation function with one parameter is called. But 5.3.6/10 N3797 C++14 working draft said that:
If the type is complete and if deallocation function lookup finds both a usual deallocation function with only a pointer parameter and a usual deallocation function with both a pointer parameter and a size parameter, then the selected deallocation function shall be the one with two parameters.
Is it a bug?