4 ms·
This is not about defining a custom operator delete, it's about defining it at all, because when compiling with -ffreestanding it is not provided, and apparentl
by lultimouomo 10y ago
This is not about defining a custom operator delete, it's about defining it at all, because when compiling with -ffreestanding it is not provided, and apparently virtual destructors synthesize call to the delete operator.
- gpderetta 10y agothat's kind of circular... having a virtual destructor is useful only if you actually are going to call delete. If you want to make sure that the object is never heap allocated, just declare the operator new as deleted and at least the issue would be always caught at compile time instead of just having a chance of catching it a runtime.
- lultimouomo 10y agoI agree, that was the sense of my original comment. Actually, most probably you don't even need to delete it as it's not defined with -ffreestanding