Edit

Share via


Compiler Error C2765

'function' : an explicit specialization of a function template cannot have any default arguments

Default arguments are not allowed on an explicit specialization of a function template. For more information, see Explicit Specialization of Function Templates.

The following sample generates C2765:

// C2765.cpp
template<class T> void f(T t) {};

template<> void f<char>(char c = 'a') {}   // C2765
// try the following line instead
// template<> void f<char>(char c) {}