[SunHELP] Sun C++ 5.2 Compiler Error: Overloading ambiguity

Nicholas Dronen sunhelp at sunhelp.org
Sun Aug 5 21:45:17 CDT 2001


On Mon, Jul 30, 2001 at 11:55:25AM -0700, Girish Dajee wrote:
> Hi,
> 
> We are moving to Forte 6 (C++ 5.2) from C++ 4.2 compilers. I am getting the
> following error:
> 
> Error: Overloading ambiguity between "CORBA::String_mgr::operator=(char*)"
> and "CORBA::String_mgr::operator=(const char*)"
> 
> Any ideas on solving this problem?

The error indicates to me that you do have two overloaded equality operators
in the String_mgr class, one that takes char * and another that takes const
char *.  I think you can do without the first one, because an overloaded
equality operator should never change the object, which means the argument
to the operator can always be const even if the variable on the right hand
side of the expression isn't.

I don't know the solution to the error, but an instructor taught always to
make non-member functions those overloaded operators which don't change the
object.

Regards,

Nicholas



More information about the SunHELP mailing list