This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14419] New: Request clarification of ambiguous overload error.
- From: "alriddoch at zepler dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Mar 2004 21:52:44 -0000
- Subject: [Bug c++/14419] New: Request clarification of ambiguous overload error.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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