title: Why can't the compiler resolve an overload of a std::function parameter?
body: <p>Observe the following example:  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;functional&gt;
  #include &lt;cstdlib&gt;
  
  void Print_Wrapper(std::function&lt;void(int)&gt; function);
  void Print(int param);
  
  int main(){
  
    Print_Wrapper(Print);
  
    return EXIT_SUCCESS;
  }
  
  void Print_Wrapper(std::function&lt;void(int)&gt; function){
    int i = 5;
    function(i);
  }
  void Print(int param){
    std::cout &lt;&lt; param &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>This works correctly, and prints <code>5</code>.  </p>
  
  <hr>
  
  <p>Now look at the same example with an overloaded function added:  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;functional&gt;
  #include &lt;cstdlib&gt;
  
  void Print_Wrapper(std::function&lt;void(int)&gt; function);
  void Print(int param);
  void Print(float param);
  
  int main(){
  
    Print_Wrapper(Print);
  
    return EXIT_SUCCESS;
  }
  
  void Print_Wrapper(std::function&lt;void(int)&gt; function){
    int i = 5;
    function(i);
  }
  void Print(int param){
    std::cout &lt;&lt; param &lt;&lt; std::endl;
  }
  void Print(float param){
    std::cout &lt;&lt; param &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>This gives the following compiler error:  </p>
  
  <blockquote>
    <p>main.cpp:11:22: error: cannot resolve overloaded function ‘Print’
    based on conversion to type ‘std::function’<br>
    Print_Wrapper(Print);</p>
  </blockquote>
  
  <p>Could some explain why the compiler can't resolve the overload?<br>
  <code>Print_Wrapper</code> only expects an int function-- the float function shouldn't even be considered.  </p>
  
  <hr>
  
  <p>Additionally, what should I do to fix this?  </p>
  
  <p>I recall problems like this occurring if a <code>typename</code> or something was left out, but then that would require me to make <code>Print_Wrapper</code> a template.<br>
  Does <code>Print_Wrapper</code> need to be a function template?  </p>
  
  <p>I guess I'm use to functionality similar to this, that just works.  For example:  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;cstdlib&gt;
  
  void Print_Wrapper(std::vector&lt;int&gt; param);
  void Print(std::vector&lt;int&gt; param);
  void Print(std::vector&lt;float&gt; param);
  
  int main(){
  
    std::vector&lt;int&gt; vi{1,2,3};
    std::vector&lt;float&gt; vf{1.0,2.0,3.0};
  
    Print(vi); //prints int
    Print(vf); //prints float
  
    Print_Wrapper(vi); //prints int (no overload issue)
    Print_Wrapper(vf); //compiler error (as expected)
  
    return EXIT_SUCCESS;
  }
  
  void Print_Wrapper(std::vector&lt;int&gt; param){
    Print(param);
    return;
  }
  void Print(std::vector&lt;int&gt; param){
    std::cout &lt;&lt; "int" &lt;&lt; std::endl;
  }
  void Print(std::vector&lt;float&gt; param){
    std::cout &lt;&lt; "float" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>So I think the issue lies somewhere in the lookup rules of an actual C++ function, as this example only uses types.  Thoughts?  </p>