title: Overload resolution with multiple functions and multiple conversion operators
body: <p>Consider simple code :</p>
  
  <pre><code>#include&lt;iostream&gt;
  
  struct A {
      operator double(){
          std::cout&lt;&lt;"Conversion function double chosen."&lt;&lt;std::endl;
          return 1.1;
      }
      operator char(){
          std::cout&lt;&lt;"Conversion function char chosen."&lt;&lt;std::endl;
          return 'a';
      }
  } a;
  
  void foo(int){}
  void foo (char){}
  int main() {
      foo(a);
  }
  </code></pre>
  
  <p>Above code works fine, and as expected <strong>gcc, clang and VC++</strong> chooses <code>foo(char)</code>. </p>
  
  <p>Now lets modify the code little bit :</p>
  
  <pre><code>#include&lt;iostream&gt;
  
  struct A {
      operator double(){
          std::cout&lt;&lt;"Conversion function double chosen."&lt;&lt;std::endl;
          return 1.1;
      }
      operator char(){
          std::cout&lt;&lt;"Conversion function char chosen."&lt;&lt;std::endl;
          return 'a';
      }
  } a;
  
  void foo(int){}
  void foo (double){} //parameter changed from char to double
  int main() {
      foo(a);
  }
  </code></pre>
  
  <p>Now this should have choose <code>foo(double)</code>, but seems only <strong>VC++</strong> is happy with the code while <strong>clang and gcc</strong> are unhappy with the above code.</p>
  
  <pre><code>main.cpp:11:10: error: call of overloaded 'foo(A&amp;)' is ambiguous
   foo(a);
       ^
  main.cpp:8:6: note: candidate: void foo(int)
   void foo(int){}
        ^
  main.cpp:9:6: note: candidate: void foo(double)
   void foo (double){} //parameter changed from char to double
        ^
  </code></pre>
  
  <p>Can anyone explain why above code fails? or is it bug?.</p>
  
  <p><strong>One more question</strong>: Do gcc and clang share code of overload resolution?</p>