Compiler Error C2105
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C2105.
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];
}
Show: