Q:

the increment of a returned value

I have defined a function like this:
int test(int n) {
    const int b = n;
    return b;
}

While in the main function, I use like this:
 int temp = test(50)++;

And the g++ reports an error:

error: lvalue required as increment operand

Actually, I'm fully confused by this. Would you like to give me some tips or explain it to me. 

A:

You can only apply ++ to an lvalue (at least of built-in type). The return value from a function can be an lvalue if if it returns a reference, but otherwise it's an rvalue (in which case, you can't apply ++ to it).

