Topic: Default assignment g++ vs. AT&T


Author: ahrens@informatik.hu-berlin.de (Klaus Ahrens)
Date: 22 Feb 1993 13:44:25 GMT
Raw View

??? WHAT'S CORRECT ???

g++ (2.2.2) explains int-assignment for B not defined in the following example:


class A {
public:
 A& operator=(const A&){ return *this;}
};

class B: A {
public:
 B() {}
 B(int) {}
};

void main()
{
 B b1;
 B b2=b1;
 b1=b2;
 b1=1;    // 1 -> B(1) -> default assignment on B ???
}

AT&T 3.0 and even BC++ 3.0 compile it with the B-default-assignment calling
the explicit A-assignment.

who's right and who's wrong ?

--------------------------------------------------------------------------------
=
=    Klaus Ahrens
=  FB Informatik
=  Humboldt_universitaet zu Berlin
=  PSF 1297
=  Clara-Zetkin-Str. 26
=
=  O 1086 Berlin
=
--------------------------------------------------------------------------------