www.digitalmars.com         C & C++   DMDScript  

c++ - [8.49] bug: no match for function 'operator delete(Type*)'

The following code does not compile with both 8.49 and 8.50 with exceptions 
enabled (-Ae):

====
#include <new>

struct A {};

struct B
{
 B() {}   // *

 void* operator new(size_t, A&) {return 0;}

 void operator delete(void*, A&) {}
};

int main()
{
    A a;

 new (a) B();
}
====

Compiler produces error "no match for function 'operator delete(Type*)'". 
Note, that commenting the line marked with * fixes it. 
Feb 13 2007