Possible Duplicate:
Deleting a pointer to const (T const*)
void operator delete (void*);
...
const char *pn = new char, *pm = (char*)malloc(1);
delete pn; // allowed !!
free(pm); // error
Demo.
It's understandable that free()
is a function, so a const void*
cannot be converted to void*
. But why is it allowed in the case of operator delete
(default or overloaded) ?
Is it not functionally a wrong construct ?