Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!rutgers!att!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c++ Subject: Re: cfront 1.2.1 bug? Keywords: is it a bug, or is it me? is it fixed in 2.0? Message-ID: <9347@alice.UUCP> Date: 11 May 89 14:18:06 GMT References: <9640@watcgl.waterloo.edu> Distribution: comp Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 30 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 code: struct A { A::A( A& ) {} }; When you declare a class with a constructor, the compiler automatically removes the void constructor that you otherwise get by default. That is, because you defined A::A(A&), you must also explicitly define A::A() if you want it. void func( A ) { } void func2() { A a; You have declared an A object without an initializer. This tried to call A::A(), which doesn't exist. Hence it's an error. func(a); } -- --Andrew Koenig ark@europa.att.com