Will returning by const lvalue reference extend lifetime of variable? If I had this code
const int& refer()
{
int x = 2938;
return x;
}
int main()
{
const int& catcher = refer();
return 0;
}
Would the lifetime of variable x
be extended to match the lifetime of the reference catcher
? Just like extending the lifetime of a temporary (rvalue) using a const lvalue reference?