Path: utzoo!attcan!uunet!oresoft!dan From: dan@oresoft.uu.net (Daniel Elbaum) Newsgroups: comp.lang.c++ Subject: Re: cfront 1.2.1 bug? Keywords: it's your code Message-ID: <688@oresoft.uu.net> Date: 11 May 89 21:20:34 GMT References: <9640@watcgl.waterloo.edu> Reply-To: dan@oresoft.uu.net (Daniel Elbaum) Distribution: comp Organization: Oregon Software, Portland, OR Lines: 38 In article <9640@watcgl.waterloo.edu> al@watsup.waterloo.edu (Al Vermeulen) writes: Could someone please explain to me what is wrong with this code? It seems innocent enough. Does it compile with cfront 2.0? To get around this problem I've been passing references to functions like func and then creating a local variable in func (gross, eh?). code: struct A { A::A( A& ) {} // Use A( A& ) {} instead }; void func( A ) { } void func2() { A a; // this constructor call needs an argument func(a); } Since you've defined a constructor for A, any definition of an instantiation of an A will cause it to be called. Since the defined constructor takes an argument, Cfront is rightly asking for one to go with the declaration of a. Func2() should look like this: void func2() { A a(a); func(a); } -- Not responsible : uunet - for this posting : tektronix \!oresoft!dan : reed / dan@oresoft.uu.net : sun!nosun -