编译器警告(等级 4)C4913

用户定义的二进制运算符 “,存在,但没有重载可以转换所有作数,默认内置二进制运算符”,使用

注解

对内置逗号运算符的调用发生在同样具有重载的逗号运算符的程序中;你认为可能已发生的转换没有发生。

Example

下面的代码示例生成 C4913:

// C4913.cpp
// compile with: /W4
struct A
{
};

struct S
{
};

struct B
{
   // B() { }
   // B(S &s) { s; }
};

B operator , (A a, B b)
{
   a;
   return b;
}

int main()
{
   A a;
   B b;
   S s;

   a, b;   // OK calls user defined operator
   a, s;   // C4913 uses builtin comma operator
           // uncomment the conversion code in B to resolve.
}