title: ambiguous partial specializations with std::enable_if
body: <p>I have a problem encountered at a condtion like below:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  #define TRACE void operator()() const { std::cerr &lt;&lt; "@" &lt;&lt; __LINE__ &lt;&lt; std::endl; }
  
  template &lt;class T&gt;
  struct check : std::true_type {};
  
  template &lt;class F, class T, class Check=void&gt;
  struct convert {
    TRACE;// first case
  };
  
  template &lt;class F, class T&gt;
  struct convert&lt;F*, T, typename std::enable_if&lt;(check&lt;F&gt;::value &amp;&amp; check&lt;T&gt;::value), void&gt;::type&gt; {
    TRACE; // second case
  };
  
  template &lt;class T&gt;
  struct convert&lt;int*, T, typename std::enable_if&lt;(check&lt;T&gt;::value), void&gt;::type&gt; {
    TRACE; // third case
  };
  </code></pre>
  
  <p>Then </p>
  
  <pre><code>convert&lt;int*, int&gt; c;
  c();
  </code></pre>
  
  <p>will report ambiguous class template instantiation in g++-4.5, g++-4.6, g++-4.7 and clang++-3.1(all with option -std=c++0x)</p>
  
  <p>But if i replace the check in third case to </p>
  
  <pre><code>typename std::enable_if&lt;(check&lt;int&gt;::value &amp;&amp; check&lt;T&gt;::value), void&gt;:type
  </code></pre>
  
  <p>Then clang++-3.1 works fine.</p>
  
  <p>Is it compilers bug or by standard?</p>