Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!motcsd!hpda!hpcuhb!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.lang.c++ Subject: Re: coercion of x op= y verses x = x op y ??? Message-ID: <1000030@hpclscu.HP.COM> Date: 5 Oct 89 22:08:46 GMT References: <6590279@hplsla.HP.COM> Organization: Hewlett-Packard Calif. Language Lab Lines: 16 > I = I * I; // okay by both g++ 1.35.x and AT&T 2.0 > I *= I; // g++ 1.35.x accepts, 2.0 calls it an error I think the key here is that in the first case, you are assigning to I a value with an implicit constructor (Int(int)). In the second case, you are either applying a "*=" operator to an Int (no such operator defined), or to an int (which is generated by a function call, which is not an lvalue). I don't know what to say here - "gcc" seems to "Do What I Mean, Not What I Say", which is nice and friendly, but I don't think this is legal.. Just one of those gotcha's (sigh!) ---- Shankar.