This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32944] operator= not ambiguous overload but does not compile
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Aug 2007 00:24:11 -0000
- Subject: [Bug c++/32944] operator= not ambiguous overload but does not compile
- References: <bug-32944-14925@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pinskia at gcc dot gnu dot org 2007-08-01 00:24 -------
You need to change the operator= to:
CString& operator=(const CString& newValue){
Otherwise you cannot bind a rvalue to the reference as it will only bind to a
lvalue and returned from operator+ is a rvalue.
In C++0x there are rvalue references which you can use but that feature is not
in a released version of GCC yet. (it is on the trunk though).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32944