Why is the first expression allowed, but the second not:
void test()
{
int a;
++a = getSomeInt();
a++ = getSomeInt();
}
Run Code Online (Sandbox Code Playgroud)
I mean, why its forbidden for the second one to be an lvalue? The second one makes sense and the first not. In the first one we increment the variable and immediately after we gave here a new value, we lose it. That's not the case in the second expression. It makes sense to assign some value …