编译器错误 C3185
在托管或 WinRT 类型“type”上使用了“typeid”,请改用“operator”
无法将 typeid 运算符应用于托管或 WinRT 类型;请改用 typeid。
下面的示例生成 C3185,并演示如何修复此错误:
// C3185a.cpp
// compile with: /clr
ref class Base {};
ref class Derived : public Base {};
int main() {
Derived ^ pd = gcnew Derived;
Base ^pb = pd;
const type_info & t1 = typeid(pb); // C3185
System::Type ^ MyType = Base::typeid; // OK
};
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈