The following program fails to compile: template<typename T> void f() {}
void g1() {} void g2() {} typedef void(*ptrType)(); int main(int argc, char** argv) { ptrType p = argc == 1 ? &f<char> : &f<int>; //<-- error ptrType p2 = argc == 1 ? &g1 : &g2; ptrType p1; if (argc== 1) p1 = &f<char>; else p1 = &f<int>; } fptr.cpp:11: error: address of overloaded function with no contextual type information As f<char> and f<int> are the same pointer-type, this shouldn't fail. It doesn't fail for non-template-functions and it aslo doesn't fail if an if/else-clause is used. tried with gcc-4.3.1, 4.2.4 and 4.1.2 on x86_64 and 4.2.3 on powerpc-uclibc -- Summary: compilation fails when pointer to template-functions are returned by ?-operator Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rbuergel at web dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36805