This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]