编译器错误 C3755

“delegate”:不能定义委托

可以声明 delegate(C++ 组件扩展),但不能定义它。

示例

以下示例生成 C3755。

// C3755.cpp
// compile with: /clr /c
delegate void MyDel() {};   // C3755

如果尝试创建委托模板,也会发生 C3755。 以下示例生成 C3755。

// C3755_b.cpp
// compile with: /clr /c
ref struct R {
   template<class T>
   delegate void D(int) {}   // C3755
};