Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C2395
Collapse the table of content
Expand the table of content

Compiler Error C2395

Error Message

'your_type::operator'op'' : CLR operator not valid. At least one parameter must be of the following types: 'T', 'T%', 'T&', 'T^', 'T^%', 'T^&', where T = 'your_type'

An operator in a managed type did not have at least one parameter whose type is the same as the type of the operator return value.

The following sample generates C2395:

// C2395.cpp
// compile with: /clr /c
value struct V {
   static V operator *(int i, char c);   // C2395

   // OK
   static V operator *(V v, char c);
   // or
   static V operator *(int i, V& rv);

Community Additions

© 2015 Microsoft