编译器错误 C2394

“your_type::operator'op'”:CLR 或 WinRT 运算符无效。 至少一个参数必须是以下类型:“T^”、“T^%”、“T^&”,其中 T =“your_type”

Windows 运行时或托管的类型中的一个运算符没有至少一个类型与运算符返回值的类型相同的参数。

以下示例生成 C2394:

// C2394.cpp
// compile with: /clr /c
ref struct Y {
   static Y^ operator -(int i, char c);   // C2394

   // OK
   static Y^ operator -(Y^ hY, char c);
   // or
   static Y^ operator -(int i, Y^& rhY);
};