title: Conversion operator + conversion constructor = unintuitive behavior?
body: <p>I don't understand why the code below prints <code>struct Value</code> instead of <code>int</code> (which implies the conversion constructor is converting to <code>Value</code> instead of <code>int</code>). (Visual C++ 2012)</p>
  
  <p>Why is this happening? Why does the compiler completely ignore the <code>Value(int)</code> constructor?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_info&gt;
  
  using namespace std;
  
  struct Value { Value(int) { } };
  
  struct Convertible
  {
      template&lt;class T&gt;
      operator T() const
      { throw typeid(T).name(); }
  };
  
  int main()
  {
      try { Value w((Convertible())); }
      catch (char const *s) { cerr &lt;&lt; s &lt;&lt; endl; }
  }
  </code></pre>
  
  <h2>Edit:</h2>
  
  <p>Even more bizarre is <a href="http://liveworkspace.org/code/1htnJu%242">this</a> (this time it's C++11 only, on GCC 4.7.2):</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;typeinfo&gt;
  
  using namespace std;
  
  struct Value
  {
      Value(Value const &amp;) = delete;
      Value(int) { }
  };
  
  struct Convertible
  {
      template&lt;class T&gt;
      operator T() const
      { throw typeid(T).name(); }
  };
  
  int main()
  {
      try { Value w((Convertible())); }
      catch (char const *s) { cerr &lt;&lt; s &lt;&lt; endl; }
  }
  </code></pre>
  
  <p>Which gives:</p>
  
  <pre><code>source.cpp: In function 'int main()':
  source.cpp:21:32: error: call of overloaded 'Value(Convertible)' is ambiguous
  source.cpp:21:32: note: candidates are:
  source.cpp:9:3: note: Value::Value(int)
  source.cpp:8:3: note: Value::Value(const Value&amp;) &lt;deleted&gt;
  </code></pre>
  
  <p>If the copy constructor is deleted, then why is there any ambiguity?!</p>