ambiguous overload ?

Zhang Wei Feng weifeng.zhang@alcatel.be
Wed Jul 5 02:19:00 GMT 2000


Hi,

I have the following question about overloading the following two functions.

int& Reg(string& name) ;
int Reg(string& name);

The g++ reports that:

CRegisterMap.c: In function `int & Reg(class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)':
CRegisterMap.c:32: new declaration `int & Reg(class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)'
CRegisterMap.c:24: ambiguates old declaration `int Reg(class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &)'

I thought g++ should make the difference between the two functions and will
call the functions correctly based on whether it is used as  lvalue or rvalue, that
is actually my purpose of overloading these two functions in this way!

Any suggestions,

Thanks for your attension!
weifeng



More information about the Gcc mailing list