This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Aug 2005 02:43:18 -0000
- Subject: [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
- References: <20040423110112.15097.wolfgang.roehrl@gi-de.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-20 02:43 -------
Here is a self contained testcase for this:
struct B1
{
virtual ~B1 () throw(){}
B1 (){}
int x;
};
struct B2
{
virtual ~B2 () throw(){}
B2 (){}
int x;
};
struct D : B1, B2
{
D (){}
~D () throw(){}
int y;
};
void f1 (D*);
void f2 (B2*);
void f3 (B1*);
int main (void)
{
f1 (::new D);
f2 (::new D);
f3 (::new D);
}
void f1 (D* p) { ::delete p; }
void f2 (B2* p) { ::delete p; }
void f3 (B1* p) { ::delete p; }
With gcc, I get:
free(): invalid pointer 0x9317010!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097