[comp.lang.c++] Bug in cfront

tjt@ati.tis.llnl.gov (Tim Tessin) (06/15/88)

There seems to be a bug in cfront (1.2.1) (on a Sun 3).  
Can anyone confirm or deny or provide a better workaround?
Example follows:

class A
	{
public:
	A(); 
	virtual ~A();	
	};

class B : public A
	{
public:
	B ();	
	~B ();
	};

class C : public A
	{
public:
	C();	
	~C();
	B b;
	//int a;
	};

C::C() {}
C::~C() {}

Note that A's destructor is virtual, making all descendant dtors (B,C) also 
virtual.  Cfront gives me the "nasty bus error" message on the definition
of ~C (last line).  The problems appears to be the member B::b in class C.
Class C may have members which don't have virtual dtors and compiles fine
(e.g. if you have the commented out line above).  The only work around
I can find, is to define the destructor bodies in a separate file and
compile with a modified version of the A class declaration which has
the virtual specifier removed.  Fortunatly, the separately compiled 
dtor is compatible with the "virtual" version of the dtor.

Tim Tessin - Lawrence Livermore National Laboratory  
PHONE: (415) 423-4560 
ARPA:  tjt@tis.llnl.gov
UUCP:  {ames,ihnp4,lll-crg,lll-lcc,mordor}!lll-tis!tjt