编译器错误 C2992
“类”: 参数列表无效或缺失
此类前加 template
或 generic 关键字,存在缺失或无效的参数。
示例
以下示例生成 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 {};
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈