static_cast Conversion constructor vs Conversion operator
<p>After reading <a href="https://stackoverflow.com/questions/1384007/conversion-constructor-vs-conversion-operator-precedence">this</a> I tried making such conversion with <code>static_cast</code>:</p>

<pre><code>class A;

class B { 
      public: 
         B(){} 

         B(const A&amp;) //conversion constructor
         { 
              cout &lt;&lt; "called B's conversion constructor" &lt;&lt; endl; 
         } 
};

class A { 
      public: 
         operator B() const //conversion operator
         { 
              cout &lt;&lt; "called A's conversion operator" &lt;&lt; endl; 
              return B(); 
         } 
};

int main()
{
    A a;

    //Original code, This is ambiguous, 
    //because both operator and constructor have same cv qualification (use -pedantic flag)
    B b = a;

    //Why isn't this ambiguous, Why is conversion constructor called, 
    //if both constructor and  operator have same c-v qualification
    B c = static_cast&lt;B&gt;(a); 
    return 0;
}
</code></pre>

<p>I expected it to not compile, because both constructor and operator have same <em>c-v qualification</em>. However it compiled, successfully and <code>static_cast</code> calls constructor instead of operator. Why? </p>

<p>(compiled using gcc 4.8.1 with <code>pedantic</code> and <code>Wall</code> flags)</p>