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

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).