I don't know if this bug has already been fixed. I tried to search the archives and found one that looked vaguely similar, about function pointers and templates, but it wasn't exactly the same.
I am using the stock compiler in Ubuntu Edgy, gcc 4.1.2 20060928. I believe it is a prerelease of 4.1.2. The following code can be compiled with every other compiler I have tried (including gcc 4.0 apart from several commercial ones), but, unfortunately, gcc 4.1.2 outputs this: overload.cpp: In function int main(): overload.cpp:18: error: no matches converting function f to type void (*)(class A&, const int&) overload.cpp:4: error: candidates are: void f(A&, const int&) overload.cpp:5: error: void f(A&) This is the code: ------------------------------------------------- class A { public: int val(void) { return x; } friend void f (A &a, const int &b) { a.x = b; } friend void f (A &a) { a.x = 0; } private: int x; }; typedef void (*fptr) (A &a, const int &b); int main (void) { A a; int b = 1; fptr g; g = f; g (a, b); return a.val(); } -------------------------------------------------- I suspect the problem can create big compatibility problems with already written math code (e.g. matrix/vector operations), and Ubuntu is currently shipping this version, potentially affecting many, many users. Thanks a lot, and sorry if it is a duplicate or known issue. I couldn't find anything similar.