This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/33940] call of overloaded 'basic_string(const<anonymous class>&)' is ambiguous for a template member function



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]