This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/22609] delete [] called on base virtual destructor class [Segmentation failed]
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jul 2005 13:24:31 -0000
- Subject: [Bug c++/22609] delete [] called on base virtual destructor class [Segmentation failed]
- References: <20050722130601.22609.sylwekbala@poczta.onet.pl>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2005-07-22 13:24 -------
You can't do this:
BaseVector* v = new Vector[10];
delete [] v; // <----- Here it is crashed
The type of the data allocated is Vector*, which is what you have
to use when you deallocate it. However, in your call to delete[] you
use BaseVector*.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22609