分享方式:


編譯器錯誤 C2768

'function': 非法使用明確範本引數

備註

編譯器無法判斷函式定義是否為函式範本的明確特製化,或函式是否為新的函式。

這個錯誤是在 Visual Studio .NET 2003 中引進的,做為編譯器一致性增強的一部分。

範例

下列範例會產生 C2768:

// C2768.cpp
template<typename T>
void f(T) {}

void f<int>(int) {}   // C2768

// an explicit specialization
template<>
void f<int>(int) {}

// global non-template function overload
void f(int) {}