Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hplsla!jima From: jima@hplsla.HP.COM (Jim Adcock) Newsgroups: comp.lang.c++ Subject: coercion of x op= y verses x = x op y ??? Message-ID: <6590279@hplsla.HP.COM> Date: 4 Oct 89 22:00:11 GMT Organization: HP Lake Stevens, WA Lines: 23 // g++ 1.35.x accepts the following, AT&T 2.0 rejects it. Which is "right"? // What are the general coercion/overloading rules for x =op y verses // x = x op y? [this seems to be another version of lvalue issues] extern "C" {int printf(const char* const p, ...);}; class Int { private: int i; public: Int(int I=0):i(I){} operator int(){return i;} }; void main() { Int I=10; printf("%d\n",(int)I); I = I * I; // okay by both g++ 1.35.x and AT&T 2.0 printf("%d\n",(int)I); I *= I; // g++ 1.35.x accepts, 2.0 calls it an error printf("%d\n",(int)I); }