Call delete[] operator with specific arguments

The only current way to call a delete[] operator with specific arguments is explicitly.

The delete[] operator should support a sugar syntactic call: delete (argument)[] pointer like its counterpart: new (argument)[size]

When the delete[] operator is called explicitly, it loses support for objects with destructor.




/* ncomputers.org */
#include<cstdlib>
using namespace std;

struct A{
    void*operator new[](size_t s){
        return malloc(s);
    }
    void operator delete[](void*p,size_t){
        free(p);
    }
    void operator delete[](void*p,size_t t,int s){
        if(realloc(p,t-s*sizeof(A))!=p)throw "Block moved!";
    }
};

int main(){
    A*a=new A[10];
    //delete (5) []a; //expected ',' before 'a'
    //delete[5]a; //expected ';' before ']' token
    //delete[] (5) a; //type ‘int’ argument given to ‘delete’, expected
    //delete[]a (5); //a’ cannot be used as a function
    //delete[]((int)5)a; //type ‘int’ argument given to ‘delete’, expected pointer
    //delete[]a((int)5); //‘a’ cannot be used as a function
    delete[]a;
    return 0;
}