This documentation is archived and is not being maintained.

Compiler Error C2768

'function' : illegal use of explicit template arguments

The compiler was unable to determine if a function definition was supposed to be an explicit specialization of a function template or if the function definition was supposed to be for a new function.

This error was introduced in Visual Studio .NET 2003, as part of the compiler conformance enhancements.

See Summary of Compile-Time Breaking Changes for more information.

The following sample generates C2768:

// C2768.cpp
// compile with: /LD
template<typename T>
void f(T)

// template<>
void f<int>(int)
// Uncomment the template<> line to make an explicit specialization or
// try the following to make a global nontemplate function overload
// void f(int)
{   // C2768