This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++: why implicit delete in destructor?
On 30-Apr-2001, Olaf Dietsche <olaf.dietsche--list.gcc-patches@exmail.de> wrote:
> Hi,
>
> Fergus Henderson <fjh@cs.mu.oz.au> writes:
>
> > > Comments anybody? Did I miss something?
> >
> > Does this patch handle the case of classes with overloaded operator delete
> > and virtual destructors?
>
> No, it doesn't.
>
> > This example should output
> >
> > ~Derived()
> > ~Base()
> > Derived::operator delete()
>
> The example output is:
>
> ~Derived()
> ~Base()
> Base::operator delete()
>
> > In other words, operator delete() acts as it if was virtual iff the
> > destructor is declared virtual.
>
> Thanks for pointing this out. So, the patch works only for really
> simple cases. Are there other cases to consider?
Not that I can think of (other than variations of that one).
But this is an ABI issue, so you need to consider compatibility
with the IA64 C++ ABI (does it specify anything about this issue?
it ought to) and any other C++ ABI(s) which g++ might want to support.
> Is this example part of the g++-3.0 testsuite?
No idea.
I guess you could find out by testing your patch and seeing what fails.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.