title: "unresolved overloaded function type" with static function in std::function
body: <p>I am getting an "unresolved overloaded function type" error when trying to pass an overloaded static function to an <code>std::function</code>.</p>
  
  <p>I am aware of similar questions, such as <a href="https://stackoverflow.com/questions/12220452/getting-the-address-of-an-overloaded-static-function">this</a> and <a href="https://stackoverflow.com/questions/2942426/how-to-specify-a-pointer-to-an-overloaded-function">this</a>. However, even though the answers there work for getting the address of the right function into a function pointer, they fail with <code>std::function</code>. Here is my MWE:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  #include &lt;functional&gt;
  
  struct ClassA {
    static std::string DoCompress(const std::string&amp; s) { return s; }
    static std::string DoCompress(const char* c, size_t s) { return std::string(c, s); }
  };
  
  void hello(std::function&lt;std::string(const char*, size_t)&gt; f) {
    std::string h = "hello";
    std::cout &lt;&lt; f(h.data(), h.size()) &lt;&lt; std::endl;
  }
  
  int main(int argc, char* argv[]) {
    std::string (*fff) (const char*, size_t) = &amp;ClassA::DoCompress;
    hello(fff);
    hello(static_cast&lt;std::string(const char*, size_t)&gt;(&amp;ClassA::DoCompress));
  }
  </code></pre>
  
  <p>Could someone explain why the <code>static_cast</code> doesn't work when the implicit one does?</p>