delete[] fails to call virtual destructor on gcc 2.95.2

Barry M. Caceres barryc@itravelpartners.com
Thu Nov 18 11:09:00 GMT 1999


I sent this in previously, but my source file had a minor typo and I forgot
to include a file in the attachment.  This is the corrected version.

=============================================================================

Version : gcc 2.95.2 (see "compile.txt" for compiler verbose output)
Platform: SunOS sideshowbob 5.6 Generic_105181-16 sun4u sparc SUNW,Ultra-5_10
Patches : See "latestpatches.txt" in attachment.  
Source  : See "destructcall.cc" in attachment.
CPP File: See "destructcall.ii" in attachment
Output  : See "a.out.txt" in sattachment

BUG     :
---------
The problem comes with the "array delete" operator.  Virtual destructors are
NOT properly being called.  When we delete through the "derived type" pointer
(i.e.: Bar*) we see that the destructor from the virtual base class "Foo" is
NOT called.  When we delete using the "base type" pointer (i.e.: Foo*) we
see that the destructor for the derived class "Bar" is NOT called. All 
destructors are _virtual_ so both cases should result in destructors from 
both classes being called.

NOTES: 
You can generate the a patch report formatted the same as latestpatches.txt
using the included script "sunpatches".
gccbug.tar.gz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gccbug.tar.gz
Type: application/x-gzip
Size: 7914 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/19991118/6ee46967/attachment.bin>


More information about the Gcc-bugs mailing list