This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

MI destructor bug


#include <iostream.h>

class a
{
public:
    a() { cout << "a: " << this << endl; }
    virtual ~a() { cout << "~a: " << this << endl; }
};

class b : public virtual a
{
public:
    b() { cout << "b: " << this << endl; }
    virtual ~b() { cout << "~b: " << this << endl; }
};

class c : public virtual b
{
public:
    c() { cout << "c: " << this << endl; }
    virtual ~c() { cout << "~c: " << this << endl; }
};

class d : public virtual c
{
public:
    d() { throw 1; cout << "d: " << this << endl; }
    virtual ~d() { cout << "~d: " << this << endl; }
};

int
main()
{
    try
    {
	d dd;
    }
    catch(int a)
    {
    }
}

This application with egcs-1.0.3a reports

a: 0xbffff734
b: 0xbffff738
c: 0xbffff73c

I believe the correct output should be:

a: 0x7fff2f3c
b: 0x7fff2f34
c: 0x7fff2f28
~c: 0x7fff2f28
~b: 0x7fff2f34
~a: 0x7fff2f3c

Matthew
-- 
Matthew Newhook				E-Mail: mailto:matthew@ooc.com
Software Designer			WWW:    http://www.ooc.com
Object Oriented Concepts, Inc.		Phone:  (978) 439 9285 x 246


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]