The problem is that the requirements of the postincrement operator for integral types and for custom types are different. In particular, the custom postincrement operator, implemented as a member function, allows the use of r values.
If you executed the operator as a free function:
MyInt operator++(MyInt [const][&] x, int)
Then the requirements of this particular operator will be those that are extracted from the actual signature. If the first argument is accepted by the value, then it takes rvalues directly, if it takes the const & argument, then it takes rvalues, if the copy constructor is available, if the argument is not accepted by the constant & , then this statement will require lvalues.
David Rodríguez - dribeas
source share