From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhang Wei Feng To: "gcc@gcc.gnu.org" Subject: ambiguous overload ? Date: Wed, 05 Jul 2000 02:19:00 -0000 Message-id: <3962FD7D.8FADE7E4@alcatel.be> X-SW-Source: 2000-07/msg00054.html 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,__default_alloc_template > &)': CRegisterMap.c:32: new declaration `int & Reg(class basic_string,__default_alloc_template > &)' CRegisterMap.c:24: ambiguates old declaration `int Reg(class basic_string,__default_alloc_template > &)' 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