#include <iostream>
using namespace std;

struct S
{
    int a;
    S(int a) : a(a) { cout << "ctor " << a << " " << this << endl; }
    ~S() { cout << "dtor " << a << " " << this << endl; }
};

S
f()
{
    S s (1);
    return S(2);
}

S
g()
{
    return S(3);
}

int
main()
{
    S&& r = f();
    g();
    S s (0);
}

% g++45 -std=gnu++0x rval.cc && ./a.out
ctor 1 0x7fffffffe7e0
ctor 2 0x7fffffffe820
dtor 1 0x7fffffffe7e0
ctor 3 0x7fffffffe830
dtor 3 0x7fffffffe830
ctor 0 0x7fffffffe810
dtor 0 0x7fffffffe810
dtor 2 0x7fffffffe820
%

右辺値参照のローカル変数で関数の戻り値を受けたら、寿命が延びるようだ。上の例で言うと、3はすぐに消えているが、2は最後まで残っている。