title: Why does this template argument deduction/overload resolution fail?
body: <p>This code snippet fails to compile in <a href="https://godbolt.org/z/OYAVY7" rel="nofollow noreferrer">MSVC</a>, <a href="https://godbolt.org/z/TOn56L" rel="nofollow noreferrer">Clang</a> and <a href="https://godbolt.org/z/PupawT" rel="nofollow noreferrer">Gcc</a>, (they give different error message):</p>
  
  <pre><code>int foo(int a, int b) {
      return a + b;
  }
  
  template &lt;class Ret, class A, class B&gt;
  void foo(Ret (*)(A, B)) {
  
  }
  
  int main() {
      foo(foo);
      return 0;
  }
  </code></pre>
  
  <p>Shouldn't this compile? I can't see why it fails in resolving the overloaded function or in deducing the template arguments. Any help is welcome, thanks.</p>
  
  <p>PS: It compiles if the template is replaced with <code>void foo(int (*)(int, int))</code>, or if we rename one of <code>foo</code> to avoid overloading.</p>