Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!uunet!mcsun!hp4nl!ruuinf!prisma!karel From: karel@prisma.cv.ruu.nl (Karel Zuiderveld) Newsgroups: comp.lang.c++ Subject: Re: GC, TC++ 1.01 calls X::X(X& (*this))! Keywords: GC, garbage collection, TC++, c++, copy constructors Message-ID: Date: 24 Jan 91 12:06:48 GMT References: <6309@celery34.UUCP> Distribution: comp Organization: University of Utrecht, 3D Computer Vision, The Netherlands Lines: 27 In <6309@celery34.UUCP> stephens@motcid.UUCP (Kurt Stephens) writes: > I know this is kinda long, but... > Has anybody else seen TC++ 1.01 generating code where a >copy constructor makes a copy of this'self? Yes, I happened to run into the same problem using TC++ 1.00 (I don't know how to get the update to 1.01 in the Netherlands :-(). I finally traced the bug down to the copy constructor of the class 'string' I was using. The workaround is obvious: an explicit test if the address of the object to copy is equal to this. Since the workaround was so easy, I didn't track down in which specific cases the bug occurs. Beware! Karel -- Karel Zuiderveld E-mail: karel@cv.ruu.nl 3D Computer Vision - Room E.02.222 Tel: (31-30) 506682/507772 Academisch Ziekenhuis Utrecht Fax: (31-30) 513399 Heidelberglaan 100, 3584 CX Utrecht, The Netherlands