Compiler Error C2826

'operator' must be declared static

Methods must be declared as static if they implement a managed operator.

C2826 is only reachable using /clr:oldSyntax.

The following sample generates C2826:

// C2826.cpp
// compile with: /clr:oldSyntax /c
using namespace System;

__value struct M {
   M op_Addition(M m1, M m2) {   // C2826
   // try the following line instead
   // static M op_Addition(M m1, M m2) {
      return m1;

Community Additions