title: Ambiguous string::operator= call for type with implicit conversion to int and string
body: <p>Given the following program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  struct GenericType{
     operator string(){
        return "Hello World";
     }
     operator int(){
        return 111;
     }
     operator double(){
        return 123.4;
     }
  };
  int main(){
     int i = GenericType();
     string s = GenericType();
     double d = GenericType();
     cout &lt;&lt; i &lt;&lt; s &lt;&lt; d &lt;&lt; endl;
     i = GenericType();
     s = GenericType(); //This is the troublesome line
     d = GenericType();
     cout &lt;&lt; i &lt;&lt; s &lt;&lt; d &lt;&lt; endl;
  }
  </code></pre>
  
  <p>It compiles on Visual Studio 11, but not clang or gcc.  It is having trouble because it wants to implicitly convert from a <code>GenericType</code> to an <code>int</code> to a <code>char</code> but it also could return a <code>string</code> and so there is an ambiguity (<code>operator=(char)</code> and <code>operator=(string)</code> both match <code>GenericType</code>).</p>
  
  <p>The copy constructor is just fine, however.</p>
  
  <p>My question is: How do I resolve this ambiguity without modifying the contents of main?  What do I need to do to modify <code>GenericType</code> to handle this situation?</p>