Sdílet prostřednictvím


Chyba kompilátoru C2244

Identifikátor: Nelze shodovat definici funkce s existující deklarací.

Poznámky

Neobvyklé použití unárního operátoru + bylo použito před voláním funkce, které nemělo závorky.

K této chybě dochází pouze v projektech C++.

Examples

Následující příklad generuje C2244:

// C2244.cpp
int func(char) {
   return 0;
}

int func(int) {
   return 0;
}

int main() {
   +func;   // C2244
}

C2244 může nastat také v případě, že je pro členovou funkci šablony třídy použit nesprávný podpis funkce.

// 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 může nastat také v případě, že je pro šablonu členské funkce použit nesprávný podpis funkce.

// 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) {}

Nelze částečně specializovat šablonu funkce.

// 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