https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98665
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Not a bug. This is equivalent to: struct X { int i; }; X f() { return { 0 }; } const int& g(const X& x) { return x.i; } int main() { const auto& i = g(f()); } The temporary's lifetime is not extended, because the reference doesn't bind directly to it.