I tried 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;
}
demo
The example calls the function to free the placement with parameter one . But working draft 5.3.6 / 10 N3797 C ++ 14 said that:
If the type is completed, and if the search for the spread function finds both a regular release function with a pointer parameter and a regular release function with a pointer parameter and a parameter size, then the selected release function must be one with two parameters .
This is mistake?
user2953119
source
share