Export (0) Print
Expand All
Expand Minimize

Compiler Error C3920

Error Message

'operator'' : cannot define a postfix increment/decrement CLR operator

The common language runtime does not support the postfix operator and user-defined postfix operators are not allowed. You can define a prefix operator and the prefix operator will be used for both pre- and post-increment operations.

The following sample generates C3920:

// C3920.cpp
// compile with: /clr /LD
public value struct V {
   static V operator ++(V me, int)
   // try the following line instead
   // static V operator ++(V me)
   {   // C3920
      me.m_i++;
      return me;
   }

   int m_i;
};

Community Additions

ADD
Show:
© 2015 Microsoft