This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33940] call of overloaded 'basic_string(const<anonymous class>&)' is ambiguous for a template member function
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Oct 2007 18:26:35 -0000
- Subject: [Bug c++/33940] call of overloaded 'basic_string(const<anonymous class>&)' is ambiguous for a template member function
- References: <bug-33940-13880@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from pcarlini at suse dot de 2007-10-29 18:26 -------
(In reply to comment #5)
> In this test case, "int" and "unsigned" are different class(thus causes
> ambiguity in my view), while in the original test case, only ONE class
> "std::string" involved---even with different type of constructors. Is it
> sufficient for the compiler to pick up one from all its definitions? Such as ,
> when we say "std::string s();" it knows which constructor it expects?
No, as I said already. Because type deduction for T depends on the type
converted to: each string constructor accepts a different type (e.g., an
allocator, a string, a pointer) and there is no "right" T. The example above is
exactly equivalent, the various overloaded f behave like the various overloaded
string constructors and clearly shows that you cannot change type deduction by
changing the return value of your conversion operator of type T().
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33940