::delete() reference generated but not used

Gabriel Dos Reis gdr@integrable-solutions.net
Wed May 5 16:23:00 GMT 2004


Paul Koning <pkoning@equallogic.com> writes:

[...]

| class B
| {
| public:
| 	virtual ~B(void) {}
| 
| 	virtual void hello(void) = 0;

[...]

| However, even though B is only a base class, it seems that gcc is
| still generating in-charge destructors for B.  As a result, we end up
| with references in the object file to ::delete() which means we get
| link errors because that operator isn't defined anywhere.

Your analyzis is correct.  I believe that the reference to 
::operator delete is an artifact of GCC emitting a deleting destructor
for B. I would say that that is a mandated behaviour of the ABI
(although I don't have the document at hand in order to check).
I don't know if the linker can safely remove that unused destructor
given dynamic linking...

-- Gaby



More information about the Gcc mailing list