public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14419] New: Request clarification of ambiguous overload error.
@ 2004-03-03 21:52 alriddoch at zepler dot org
2004-03-03 21:53 ` [Bug c++/14419] " alriddoch at zepler dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: alriddoch at zepler dot org @ 2004-03-03 21:52 UTC (permalink / raw)
To: gcc-bugs
The attached code gives an ambiguous overload error on line 22, the full text of
which is pasted below. I am not sure whether this is a bug, but it seems strange
to me that gcc things there is ambiguity when multiple conversions are available
if one of the conversions is an exact match for the type required (std::string)
and the other two available (int, and bool) are not really the right type for
the other two constructors which take "const _CharT *" and "_CharT" respectively.
ambiguous_test.cpp: In function `int main()':
ambiguous_test.cpp:22: error: ambiguous overload for 'operator=' in 's2 = a'
/usr/include/c++/3.3.2/bits/basic_string.h:358: error: candidates are:
std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
_Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits,
_Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc =
std::allocator<char>]
/usr/include/c++/3.3.2/bits/basic_string.h:361: error:
std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
_Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char, _Traits =
std::char_traits<char>, _Alloc = std::allocator<char>] <near match>
/usr/include/c++/3.3.2/bits/basic_string.h:364: error:
std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT,
_Traits, _Alloc>::operator=(_CharT) [with _CharT = char, _Traits =
std::char_traits<char>, _Alloc = std::allocator<char>]
--
Summary: Request clarification of ambiguous overload error.
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alriddoch at zepler dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14419
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/14419] Request clarification of ambiguous overload error.
2004-03-03 21:52 [Bug c++/14419] New: Request clarification of ambiguous overload error alriddoch at zepler dot org
@ 2004-03-03 21:53 ` alriddoch at zepler dot org
2004-03-03 22:15 ` konqueror at gmx dot de
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: alriddoch at zepler dot org @ 2004-03-03 21:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From alriddoch at zepler dot org 2004-03-03 21:53 -------
Created an attachment (id=5857)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5857&action=view)
Testcase described in body of report
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14419
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/14419] Request clarification of ambiguous overload error.
2004-03-03 21:52 [Bug c++/14419] New: Request clarification of ambiguous overload error alriddoch at zepler dot org
2004-03-03 21:53 ` [Bug c++/14419] " alriddoch at zepler dot org
@ 2004-03-03 22:15 ` konqueror at gmx dot de
2004-03-03 22:31 ` [Bug libstdc++/14419] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: konqueror at gmx dot de @ 2004-03-03 22:15 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |konqueror at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14419
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/14419] Request clarification of ambiguous overload error.
2004-03-03 21:52 [Bug c++/14419] New: Request clarification of ambiguous overload error alriddoch at zepler dot org
2004-03-03 21:53 ` [Bug c++/14419] " alriddoch at zepler dot org
2004-03-03 22:15 ` konqueror at gmx dot de
@ 2004-03-03 22:31 ` pinskia at gcc dot gnu dot org
2004-03-03 22:49 ` bangerth at dealii dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-03 22:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-03 22:30 -------
No this is not a bug as the last match:
/Users/pinskia/fsf-clean-nocheck/lib/gcc/powerpc-apple-darwin7.2.0/3.5.0/../../../../include/c++/
3.5.0/bits/basic_string.h:438: note: std::basic_string<_CharT, _Traits, _Alloc>& std::
basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char, _Traits = std::
char_traits<char>, _Alloc = std::allocator<char>]
means that it can go through the conversion from bool to char to get able to call that one and the first
one matches because it can go through "std::string" so it is ambiguous which one should be picked by
the compiler.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c++ |libstdc++
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14419
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/14419] Request clarification of ambiguous overload error.
2004-03-03 21:52 [Bug c++/14419] New: Request clarification of ambiguous overload error alriddoch at zepler dot org
` (2 preceding siblings ...)
2004-03-03 22:31 ` [Bug libstdc++/14419] " pinskia at gcc dot gnu dot org
@ 2004-03-03 22:49 ` bangerth at dealii dot org
2004-04-06 1:15 ` [Bug c++/14419] " pinskia at gcc dot gnu dot org
2004-04-06 1:15 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-03-03 22:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-03 22:49 -------
I don't want to close this PR so quickly. I looked at it, too, and the
point I see is that there is a conversion operator that converts
the object to something that exactly matches the arguments of one
of the constructors of std::string. On the other hand, the two other
cited constructors need an additional conversion from int to char or
from bool to char. The fact that the first is not taken seems at least
confusing to me as well, so I'd like that this is settled by citing the
relevant parts of the standard.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14419
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/14419] Request clarification of ambiguous overload error.
2004-03-03 21:52 [Bug c++/14419] New: Request clarification of ambiguous overload error alriddoch at zepler dot org
` (3 preceding siblings ...)
2004-03-03 22:49 ` bangerth at dealii dot org
@ 2004-04-06 1:15 ` pinskia at gcc dot gnu dot org
2004-04-06 1:15 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-06 1:15 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|libstdc++ |c++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14419
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/14419] Request clarification of ambiguous overload error.
2004-03-03 21:52 [Bug c++/14419] New: Request clarification of ambiguous overload error alriddoch at zepler dot org
` (4 preceding siblings ...)
2004-04-06 1:15 ` [Bug c++/14419] " pinskia at gcc dot gnu dot org
@ 2004-04-06 1:15 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-06 1:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-06 01:15 -------
This is a dup of bug 14830 which has a better explaination of why the error is right.
*** This bug has been marked as a duplicate of 14830 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14419
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-04-06 1:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-03 21:52 [Bug c++/14419] New: Request clarification of ambiguous overload error alriddoch at zepler dot org
2004-03-03 21:53 ` [Bug c++/14419] " alriddoch at zepler dot org
2004-03-03 22:15 ` konqueror at gmx dot de
2004-03-03 22:31 ` [Bug libstdc++/14419] " pinskia at gcc dot gnu dot org
2004-03-03 22:49 ` bangerth at dealii dot org
2004-04-06 1:15 ` [Bug c++/14419] " pinskia at gcc dot gnu dot org
2004-04-06 1:15 ` 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).