This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
virtual destructors and operator delete
- From: Piotr Wyderski <piotr dot wyderski at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 21 Feb 2009 14:42:02 +0100
- Subject: virtual destructors and operator delete
Hi,
I have an auto-duration only class X in C++0x:
class X {
void* operator new(std::size_t) = delete;
void operator delete(void*) = delete;
public:
virtual ~X() {}
};
But GCC 4.4 fails to compile it:
main.cpp: In destructor 'virtual X::~X()':
main.cpp:4140: error: deleted function 'static void X::operator delete(void*)'
main.cpp:4144: error: used here
Is it a bug? If not, then why is it needed?
I have a similar example with a missing "unneeded" copy constructor.
Best regards, Piotr