Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!roundup.crhc.uiuc.edu!pacific.csl.uiuc.edu!steven From: steven@pacific.csl.uiuc.edu (Steven Parkes) Newsgroups: comp.lang.c++ Subject: implicit conversion to a reference Message-ID: <1991May1.143350.19206@roundup.crhc.uiuc.edu> Date: 1 May 91 14:33:50 GMT Sender: news@roundup.crhc.uiuc.edu Reply-To: steven@pacific.csl.uiuc.edu Followup-To: comp.lang.c++ Organization: Coordinated Science Laboratory, University of Illinois Lines: 31 Under cfront 2.0, in the following program, x does not seem to convert to an (int&) the way that we think it should. Any comments on what the correct semantics for this syntax are? Could someone run it under cfront 2.1 and tell us whether it produces an error or not ... class Int { public: Int () {} Int ( int x ) : me ( x ) {} operator int& () { return me; } int* operator & () { return &me; } private: int me; }; int f(int x ) { return x; } main() { Int x; x=10; // works x+=5; // works x = * &x; // works f(x); // this doesn't work ... f( (int&) x); // ... but this does }