共用方式為


編譯器錯誤 C2991

重複定義類型參數 'parameter'

parameter的兩個泛型或樣板定義之間發生類型衝突。 定義多個泛型或樣板參數時,您必須使用對等的類型。

下列範例會產生 C2991:

// C2991.cpp
// compile with: /c
template<class T, class T> struct TC {};   // C2991
// try the following line instead
// template<class T, class T2> struct TC {};

使用泛型時,也會發生 C2991:

// C2991b.cpp
// compile with: /clr /c
generic<class T,class T> ref struct GC {};   // C2991
// try the following line instead
// generic<class T,class T2> ref struct GC {};