template<int> void foo() {} void test() { foo<1>(); // (1) void (*func)() = foo<1>; // (2) foo<1>; // (3) void* d = (void*)foo<1>; // (4) }
(1) and (2) are OK. (3) fails with: error: statement cannot resolve address of overloaded function (4) fails with: error: insufficient contextual information to determine type -- Summary: unable to take address of template function Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: joerg dot richter at pdv-fs dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35398