Compiler Warning (level 4) C4347

behavior change: 'function template' is called instead of 'function'

This warning is obsolete. It is only generated in Visual Studio 2005 through Visual Studio 2010. In Visual Studio .NET, if you had a template function and a nontemplate function with the same name as the template function, the compiler incorrectly treated the nontemplate function as a specialization of the template function.

For code that works the same in all versions of Visual C++, add template<> above the nontemplate function, making it a real explicit specialization.

This warning is off by default in the versions of Visual Studio that generate it. For more information, see Compiler Warnings That Are Off by Default.

The following sample generates C4347 in Visual Studio 2005 through Visual Studio 2010.

// C4347.cpp
// compile with: /W4 /EHsc
#pragma warning (default : 4347)

template <typename T>
void f(T t) { T i = t; i = 0; }

void f(int i) { i++; }

// OK
template <typename T>
void f2(T t) { T i = t; i = 0; }

template <>
void f2(int i) { i++; }

int main() {
   f(5);   // regular function call
   f<int>(5);   // C4347 calls implicit instantiation