共用方式為


編譯器錯誤 C2992

'class': 類型參數清單無效或遺漏

這個類別的前面加上參數遺漏或無效的 templategeneric 關鍵字。

範例

下列範例會產生 C2992:

// C2992.cpp
// compile with: /c
template <class T>
struct Outer {
   template <class U>
   struct Inner;
};

template <class T>   // C2992
struct Outer<T>::Inner {};

template <class T>
template <class U>   // OK
struct Outer<T>::Inner {};

使用泛型時,也可能會發生 C2992:

// C2992b.cpp
// compile with: /c /clr
generic <class T>
ref struct Outer {
   generic <class U>
   ref struct Inner;
};

generic <class T>   // C2992
ref struct Outer<T>::Inner {};

generic <class T>
generic <class U>   // OK
ref struct Outer<T>::Inner {};