I have read this and this, but I still do not understand why the following code compiles in XCode:
void func2(string &s) {
s = "yyyyy";
}
void func(string &&s) {
func2(s);
}
int main() {
func("xxxxx");
return 0;
}
I think an rvalue reference shouldn't be converted to a non-const lvalue reference, right? In general, what's the rule of conversion between lvalue references and rvalue references? I already know that const lvalue reference can bind to rvalues, but what about rvalue references (rather than rvalues)? Thanks a lot!