This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13308] C++ operator ambiguity error
- 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: 5 Dec 2003 00:19:07 -0000
- Subject: [Bug c++/13308] C++ operator ambiguity error
- References: <20031205000832.13308.alexander.gdalevich@dvtsensors.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-05 00:19 -------
Here is the warning I get on the mainline (yes the warning is fixed already):
test_class.cpp: In function `int whatever(CDSPString*, int)':
test_class.cpp:53: error: ISO C++ says that these are ambiguous, even though the worst
conversion for the first is better than the worst conversion for the second:
test_class.cpp:29: note: candidate 1: CDSPString operator+(const char*, const CDSPString&)
test_class.cpp:53: note: candidate 2: operator+(char*, int) <built-in>
The problem is that bool can and will be converted into an int.
One thing you can do is add a constructor for char* and then have the operator+ be const
CDSPString&, const CDSPString&.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13308