This is normal. In C ++ 11, you can do this:
int&& a = foo(); a = 123;
You can somehow think of such temporary (conceptually and generally):
x = func(); // translated as: auto __temporary = func(); x = __temporary; __destruct_value_now_and_not_later(__temporary);
Except that x is a definition of a reference type, the compiler notes that you purposefully refer to a temporary value and extend its lifetime by removing the early destruction code, making it normal.
source share