Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!bruce!damian From: damian@bruce.cs.monash.OZ.AU (Damian Conway) Newsgroups: comp.lang.c++ Subject: g++ bug (?) Message-ID: <3018@bruce.cs.monash.OZ.AU> Date: 6 Sep 90 03:27:52 GMT Organization: Monash Uni. Computer Science, Australia Lines: 49 We have g++ 1.37.1 running on a Sun 350. I _thought_ that if a class has no defined operator= the default is copy by member. However.... class class1 { int d; public: class1() {d=1;} friend class1& operator=(class1&,class1); }; class1& operator=(class1& c1,class1 c2) { c1.d=c2.d; return c1; } class class2 { int d; public: class2() {d=1;} }; main() { class2 c1,c2; c1 = c2; } produces: test.c: In function int main (): test.c:25: bad argument 0 for function `operator = (class class1 &, class class1)' (type was class class2 ) Questions: Is the defect in my understanding of g++? Is this a known bug? Is there a known fix? damian ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ who: Damian Conway email:..!seismo!munnari!bruce.oz!damian where: Dept. Computer Science phone: +61-3-565-5779 Monash University quote: "A pessimist is never disappointed." Clayton 3168 AUSTRALIA