rodolfo@xxxxxxxxxxx writes: > Hi, I don't know if this is a C++ or g++ problem, but this snippet > doesn't compile, but I think it should: > > template <class T> void test(const char *par); > > template <> void test<int>(const char *par = 0) {} > > int main() > { > test<int>(); > } > > g++ 3.4.5 returns the following errors: > test.cpp:3: error: default arguments are only permitted for function parameters > test.cpp:7: error: no matching function for call to `test()' > > Well, the first error text is a little bit misleading because I'm > defining a default argument for a function parameter, but somehow this > is not parsed correctly, and g++ thinks it's not a function. > > So, is this allowed in c++ or is a g++ parse bug? No. See Section 14.7.3, Para. 21. "Default function arguments shall not be specified in the explicit specialization of a function template." Andrew.