[Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Aug 20 04:33:00 GMT 2005
------- 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
More information about the Gcc-bugs
mailing list