title: SFINAE not working on llvm/clang
body: <p>In the following code I'm trying to call a functor with whatever it takes as its parameters, "whatever" being a limited set of options (the two here are not the only ones in my code). </p>
  
  <pre><code>#include &lt;memory&gt;
  #include &lt;iostream&gt;
  
  template&lt;class T&gt;
  struct call_with_pointer {
      // last resort: T*
      template&lt;class Callable&gt;
      static auto call(Callable &amp;callable, const std::shared_ptr&lt;T&gt; &amp;param) -&gt; decltype(callable(param.get())) {
          return callable(param.get());
      }
  };
  
  template&lt;class T&gt;
  struct call_with_shared : public call_with_pointer&lt;T&gt; {
  
      // best: call with shared_ptr&lt;T&gt;.
      // SFINA
      // error: Candidate template ignored: substitution failure [with Callable = Test]: no matching function for call to object of type 'Test'
      template&lt;class Callable&gt;
      static auto call(Callable &amp;callable, const std::shared_ptr&lt;T&gt; &amp;param) -&gt; decltype(callable(param)) {
          return callable(param);
      }
  
      using call_with_pointer&lt;T&gt;::call;
  };
  
  
  class Test {
  public:
      bool operator () (int * x) {
          return *x == 42;
      }
  };
  
  int main ()
  {
      Test t;
  
      auto i = std::make_shared&lt;int&gt;(4);
  
      auto x = call_with_shared&lt;int&gt;::call(t, i); // No matching function for call to 'call'
  
      return 0;
  }
  </code></pre>
  
  <p>This code works just fine in VS and <a href="http://ideone.com/5pkSf" rel="nofollow">GCC</a>. Unfortunately it does not in clang. The error message is:</p>
  
  <blockquote>
    <p>No matching function for call to 'call' </p>
    
    <p>Candidate template ignored: substitution failure [with Callable = Test]: no matching function for
    call to object of type 'Test'</p>
  </blockquote>
  
  <p>So it ignores the candidate that uses the smart pointer. Good. But it does not seem to continue with considering the inherited call that would work just fine. </p>
  
  <p><em>Question: How can I work around this? How can I make llvm do the right thing here?</em></p>