Some C++ class has overloaded new operator
and in the same time the delete should not be called freely from an outside. So I protected this delete operator. Also, I marked all class constructors with noexcept
modern C++ keyword in order the compiler will not produce an exception handling code calling delete(). But it still happens when compiling by gcc! It gives the following error on the line where my new operator is called:
error: ‘static void MyClass::operator delete(void*)’ is protected
I have gcc version 5.4.0 20160609 on my Ubuntu.The same code is normally compiled under VS-2017.
Please help. How can you correctly protect the delete?