[comp.sys.mac.misc] BUG in MPW C++ v3.1

woody@truebalt.caltech.edu (William Edward Woody) (12/09/90)

I am sorry if I'm not posting this to the correct newsgroup.  I'm also sorry
if this bug has been previously found and noted.

The following segment of C++ code will crash my MPW C++ (v3.1) compiler
consistantly, with both the MPW C v3.1 C compiler and the MPW C v3.2b1 C
compiler (provided with the C++ 3.1 distribution).  Both times the compiler
crashes by either hanging the system or generating an address error in the
C compiler.  (!)

I believe what is happening is that the C++ v3.1 compiler is generating
incorrect C code, but I haven't bothered to look at the generated code to
see what's going on.


	/************************************************/
	/*						*/
	/*	This crashes the MPW C++ v3.1 compiler	*/
	/*  when ran with either the MPW C v3.1 or the	*/
	/*  MPW C v3.2b1 compilers.  This test was ran	*/
	/*  under the MPW v3.1 shell.			*/
	/*						*/
	/************************************************/


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

	class b : public a {
	};

	class c : public b {
	};

	class d : public c {
	};

	class e : public d {
		~e();
	};		

	e::~e()		// <-- bombs here.
	{
	}

	/************************************************/

Note that if you make class 'e' a child of class 'c' the compiler doesn't
die.

The only workaround I can come up with right now is to create explicit
destructors for all the classes 'b' through 'd'; this seems to work.

Oh, by the way, I'm using the following (report samari-zed from the
MacEnvy CDEV:

	Mac II with 8 megabytes RAM, 68851 installed.
	Using System 6.0.4, with Multifinder (v 6.1b9) active.

And I'm using the following Inits:  (from INIT CDEV v2.0)

	Init Tracker
	Gatekeeper Aid
	Gatekeeper
	Daylight
	FaxMonitor	(for the Dove Fax haning off my system)
	Programmer's Key
	SUM Shield INIT
	SuperClock!
	~ATM (version 2.0)	-- Adobe's Type Manager

Hope this helps any unwary C++ programmers out there...

				-- Bill

-- 
	William Edward Woody		   | Disclamer:
USNAIL	P.O.Box 50986; Pasadena, CA 91115  |
EMAIL	woody@tybalt.caltech.edu	   | The useful stuff in this message
ICBM	34 08' 44''N x 118 08' 41''W	   | was only line noise.