Function with default parameter as template type
问题 I am trying to use a function with a default argument as a function pointer template parameter: template <void (*F)()> class A {}; void foo1(int a = 0) {} void foo2() {} int main() { //A<foo1> a1; <-- doesn't work A<foo2> a2; } The compiler error is: main.cpp:7:7: error: could not convert template argument ‘foo1’ to ‘void (*)()’ Is there specific syntax for this to work? Or a specific language limitation? Otherwise, the alternative is to have two separate functions instead of a default