Why is the maladaptation function called with one argument instead of two?

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?

+4
source share
3 answers

++ 14, ++ 11. -std=c++14 , , . , ++ 14 .

+5

, ++ 1y, 1788 :

:

  • ( ) (, ) , .

  • , .

+1

3.7.4.2/2 N3797 :

T operator delete [] , ( ) . T delete [], named operator delete [] , std:: size_t, .

[], , .

0

All Articles