I read a lot of rvalue lvalue related questions and blogs, and now I have the following question.
When assigning some object to reference variable, why is it OK that the right-hand-side is not rvalue.
int x = 11;
int& rx = x ; // x is lvalue.
I came to the following two possible answers for this question. Which is correct? Or what other answer is correct?
- x (lvalue) is implicitly converted to rvalue.
- int& rx = is not a usual assignment, and the right hand side need not be rvalue.
(ref.) * http://eli.thegreenplace.net/2011/12/15/understanding-lvalues-and-rvalues-in-c-and-c * Does initialization entail lvalue-to-rvalue conversion? Is `int x = x;` UB?