This documentation is archived and is not being maintained.

Compiler Warning (level 4) C4347

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

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.

For more information, see Summary of Compile-Time Breaking Changes.

This warning is off by default. For more information, see Compiler Warnings That Are Off by Default.

The following sample generates C4347:

// C4347.cpp
// compile with: /W4 /EHsc
#pragma warning (default : 4347)
#include <iostream>
using namespace std;
template <typename T>
void f(T t)
   cout << "in void f(T t), t = " << t << endl;

// template <>
void f(int i)
{   // C4347 uncomment template<>
   cout << "in void f(int i), i = " << i << endl;

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