This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
ambiguous overload ?
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Subject: ambiguous overload ?
- From: Zhang Wei Feng <weifeng dot zhang at alcatel dot be>
- Date: Wed, 05 Jul 2000 11:18:53 +0200
- Organization: Alcatel Telecom
- Reply-To: weifeng dot zhang at alcatel dot be
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