Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!usc!jarthur!petunia!kestrel.edu!gyro From: gyro@kestrel.edu (Scott Layson Burson) Newsgroups: comp.lang.c++ Subject: Re: implicit conversion from a reference Message-ID: <1991May24.054434.13218@kestrel.edu> Date: 24 May 91 05:44:34 GMT References: <1991May2.142710.7034@clear.com> <1991May4.040222.12992@kestrel.edu> <1991May9.155949.25063@clear.com> Organization: Kestrel Institute, Palo Alto, CA Lines: 35 In article <1991May9.155949.25063@clear.com> rmartin@clear.com (Bob Martin) writes: >In article <1991May4.040222.12992@kestrel.edu> > gyro@kestrel.edu (Scott Layson Burson) writes: > >>In article <1991May2.142710.7034@clear.com> > rmartin@clear.com (Bob Martin) writes: > >>>It appears that the compiler is invoking the rule as stated in 12.3.2 of >>>the ARM: "At most one user-defined conversion (Constructor or >>>conversion function) is implicitly applied to a single value." Thus >>>the compiler is willing to convert Int to int& but not willing to >>>convert Int to int since that would take two implicit steps. >> >>I don't understand this. The conversion from `int&' to `int' is not >>a user-defined conversion. I can find no rule in the ARM that >>explains why `Int' cannot be converted to `int'. >> >>However, G++ 1.37.1 doesn't like it either, so it's hard to believe >>it's a bug. Then again, G++ doesn't like the line `x += 5;' either. >> >>Can anyone explain what's going on here? > >Scott: >One way to interpret the rule quoted above is that the compiler will >either apply some implicit conversions to an object. Or it will >apply at most ONE user defined conversion implicitly. That's not what I take to be the plain meaning of the sentence quoted above. Seems to me that either the rule is very poorly worded, or it has been misinterpreted. I will see if I can get clarification from the committee. -- Scott Gyro@Reasoning.COM