'identifier' : 無法比對函式定義與現有的宣告
備註
在沒有括弧的函數調用前面使用了一元 + 運算符的異常用法。
此錯誤只會發生在C++專案中。
範例
下列範例會產生 C2244:
// C2244.cpp
int func(char) {
return 0;
}
int func(int) {
return 0;
}
int main() {
+func; // C2244
}
當類別範本的成員函式函式使用不正確的函式簽章時,也會發生 C2244。
// C2244b.cpp
// compile with: /c
template<class T>
class XYZ {
void func(T t);
};
template<class T>
void XYZ<T>::func(int i) {} // C2244 wrong function signature
// try the following line instead
// void XYZ<T>::func(T t) {}
當成員函式範本使用不正確的函式簽章時,也會發生 C2244。
// C2244c.cpp
// compile with: /c
class ABC {
template<class T>
void func(int i, T t);
};
template<class T>
void ABC::func(int i) {} // C2244 wrong signature
// try the following line instead
// void ABC::func(int i, T t) {}
您無法部分特製化函式範本。
// C2244d.cpp
template<class T, class U>
class QRS {
void func(T t, U u);
};
template<class T>
void QRS<T,int>::func(T t, int u) {} // C2244