Export (0) Print
Expand All
Expand Minimize

Compiler Error C2105

Error Message

'operator' needs l-value

The operator must have an l-value as operand.

The following sample generates C2105:

// C2105.cpp
int main() {
   unsigned char * p1 = 0;
   unsigned int * p2 = (unsigned int *)p1;
   p2++;

   unsigned int * p = 0;
   p++;   // ok

   p2 = (unsigned int *)p1;
   ((unsigned int *)p1)++;   // C2105
}

The following sample generates C2105:

// C2105b.cpp
int main() {
   int a[10] = {0};
   int b[10] = {0};
   ++(a , b);   // C2105

   // OK
   ++(a[0] , b[0]);
   ++a[0];
}

Community Additions

ADD
Show:
© 2014 Microsoft