title: Passing a concept-constrained function overload
body: <p>The following code fails to compile (<a href="https://godbolt.org/z/Gd89b7nTq" rel="noreferrer">Godbolt link</a>):</p>
  <pre><code>#include &lt;concepts&gt;
  
  template &lt;class Fn&gt;
  decltype(auto) g(Fn&amp;&amp; fn) { return fn(); }
  
  template &lt;typename T&gt;
  requires(std::integral&lt;T&gt;) int f() { return 0; }
  
  template &lt;typename T&gt;
  int f() { return 1; }
  
  int main() {
    f&lt;int&gt;();
    f&lt;void&gt;();
    g(f&lt;int&gt;); // error: invalid initialization of non-const reference of type 'int (&amp;)()'
               // from an rvalue of type '&lt;unresolved overloaded function type&gt;'
    g(f&lt;void&gt;);
  }
  </code></pre>
  <p>It seems unexpected to me that the overload resolution succeeds when calling <code>f&lt;int&gt;()</code> (selecting the constrained version as a better match than the unconstrained version) but fails when passing <code>f&lt;int&gt;</code> as an argument.</p>
  <p>Note that changing the unconstrained version to a disjoint constraint does make it compile (<a href="https://godbolt.org/z/7K5zs7zP3" rel="noreferrer">Godbolt link</a>):</p>
  <pre><code>#include &lt;concepts&gt;
  
  template &lt;class Fn&gt;
  decltype(auto) g(Fn&amp;&amp; fn) { return fn(); }
  
  template &lt;typename T&gt;
  requires(std::integral&lt;T&gt;) int f() { return 0; }
  
  template &lt;typename T&gt;
  requires(!std::integral&lt;T&gt;) int f() { return 1; }
  
  int main() {
    f&lt;int&gt;();
    f&lt;void&gt;();
    g(f&lt;int&gt;);
    g(f&lt;void&gt;);
  }
  </code></pre>
  <p>So is the compiler behavior correct? And if so, is this an inconsistency in the standard, or is it intended to work this way?</p>