[omniORB] Ambiguous conversion operators in OO4

Carl Thompson cet@carlthompson.net
Fri, 16 Nov 2001 18:56:59 -0800


Hello, in the case of PortableServer::ObjectId_var omniORB generates these 
two conversion operators:

    PortableServer::ObjectId_var operator PortableServer::ObjectId &();
    PortableServer::ObjectId_var operator const PortableServer::ObjectId &() 
const;

However, in the case where PortableServer::ObjectId_var is non-const and we 
wish to convert to const PortableServer::ObjectId & neither conversion is an 
exact match and neither is "better" than the other hence the conversion is 
ambiguous.  The very latest versions of GCC will complain about this.  To 
solve this another conversion operator needs to be added:

    PortableServer::ObjectId_var operator const PortableServer::ObjectId &();

The same problem may exist with all _var and _ptr classes.  I don't know; I 
didn't check.

Thanks,
Carl Thompson