www.digitalmars.com         C & C++   DMDScript  

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

This code does not compile in both 8.50 and 8.49 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();
}
===

The error is "no match for function 'operator delete(B*)'".

Note, that commenting line marked with * fixes the problem.
Feb 13 2007