编译器警告 C4950

“type_or_member”:标记为过时

使用 ObsoleteAttribute 属性将成员或类型标记为过时。

始终发出 C4950 错误。 可以使用 warning pragma 指令或 /wd 编译器选项关闭此警告。

示例

下面的示例生成 C4950:

// C4950.cpp
// compile with: /clr
using namespace System;

// Any reference to Func3 should generate an error with message
[System::ObsoleteAttribute("Will be removed in next version", true)]
Int32 Func3(Int32 a, Int32 b) {
   return (a + b);
}

int main() {
   Int32 MyInt3 = ::Func3(2, 2);   // C4950
}