public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13308] New: C++ operator ambiguity error
@ 2003-12-05 0:08 alexander dot gdalevich at dvtsensors dot com
2003-12-05 0:11 ` [Bug c++/13308] " alexander dot gdalevich at dvtsensors dot com
2003-12-05 0:19 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: alexander dot gdalevich at dvtsensors dot com @ 2003-12-05 0:08 UTC (permalink / raw)
To: gcc-bugs
I've been trying to compile a file on a i686-pc-cygwin host using sh-elf cross
compiler version 3.3.2.
Compiler build configuration options:
------------------------------------------
Configured with: ../gcc-3.3.2/configure --target=sh-elf --prefix=/gcc_build/sh4
--enable-languages=c,c++ --with-newlib --program-prefix=sh-elf- --disable-thread
s --with-gxx-include-dir=/gcc_build/sh4/sh-elf/include -v
Thread model: single
gcc version 3.3.2
Command line that causes the problem:
------------------------------------------
$ sh-elf-gcc -v -save-temps -Wall -fno-exceptions -fno-rtti \
-fno-implicit-templates -m4 -mb -fno-delayed-branch -O2 \
-fomit-frame-pointer -c test_class.cpp
Problem:
------------------------------------------
test_class.cpp: In function `int whatever(CDSPString*, int)':
test_class.cpp:53: error: ISO C++ says that `CDSPString operator+(const char*,
const CDSPString&)' and `operator+' are ambiguous even though the worst
conversion for the former is better than the worst conversion for the latter
--
Summary: C++ operator ambiguity error
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alexander dot gdalevich at dvtsensors dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-cygwin
GCC target triplet: sh-*-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13308
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/13308] C++ operator ambiguity error
2003-12-05 0:08 [Bug c++/13308] New: C++ operator ambiguity error alexander dot gdalevich at dvtsensors dot com
@ 2003-12-05 0:11 ` alexander dot gdalevich at dvtsensors dot com
2003-12-05 0:19 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: alexander dot gdalevich at dvtsensors dot com @ 2003-12-05 0:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From alexander dot gdalevich at dvtsensors dot com 2003-12-05 00:11 -------
Created an attachment (id=5276)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5276&action=view)
source and preprocessed (.ii) file
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13308
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/13308] C++ operator ambiguity error
2003-12-05 0:08 [Bug c++/13308] New: C++ operator ambiguity error alexander dot gdalevich at dvtsensors dot com
2003-12-05 0:11 ` [Bug c++/13308] " alexander dot gdalevich at dvtsensors dot com
@ 2003-12-05 0:19 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-05 0:19 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-12-05 0:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-05 0:08 [Bug c++/13308] New: C++ operator ambiguity error alexander dot gdalevich at dvtsensors dot com
2003-12-05 0:11 ` [Bug c++/13308] " alexander dot gdalevich at dvtsensors dot com
2003-12-05 0:19 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).