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