Compiler Error C2678
binary 'operator' : no operator defined which takes a left-hand operand of type 'type' (or there is no acceptable conversion)
To use the operator, you must overload it for the specified type or define a conversion to a type for which the operator is defined.
C2678 can occur if you do not pin a native member before calling a member function on it.
Example
The following sample generates C2678.
// C2678.cpp
// compile with: /clr /c
struct S { int _a; };
ref class C {
public:
void M( S param ) {
test = param; // C2678
// OK
pin_ptr<S> ptest = &test;
*ptest = param;
}
S test;
};
The following sample generates C2678.
// C2678_2.cpp
// compile with: /clr:oldSyntax /c
struct S { int _a; };
__gc class C {
public:
void M(S param) {
test = param; // C2678
// OK
S __pin* ptest = &test;
*ptest = param;
}
S test;
};