http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16070
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-10-22 14:02:29 UTC --- @Ivan, GCC 4.7 gives: pr16070.cc:5:20: error: no matching function for call to ‘Bar(<unresolved overloaded function type>)’ pr16070.cc:5:20: note: candidates are: pr16070.cc:3:9: note: template<class T> void Bar(const T&) pr16070.cc:3:9: note: template argument deduction/substitution failed: pr16070.cc:5:20: note: couldn't deduce template parameter ‘T’ pr16070.cc:4:9: note: void Bar(int) pr16070.cc:4:9: note: no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘int’ which seems better, no? Compare to Clang: /tmp/webcompile/_30708_0.cc:5:15: error: no matching function for call to 'Bar' int main() { Bar(f); } ^~~ /tmp/webcompile/_30708_0.cc:4:9: note: candidate function not viable: no overload of 'f' matching 'int' for 1st argument void Bar(int i) {} ^ /tmp/webcompile/_30708_0.cc:3:9: note: candidate template ignored: couldn't infer template argument 'T' void Bar(const T& t) {} ^ so g++ is not as good as clang, but it got closer at GCC 4.7. Perhaps g++ could handle better the "unresolved overloaded function type"? (Gosh! how can clang be that good at this?)