https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105994
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- const bar& test = h(foo{t}) The temporary for foo here since it is not bound directly to the variable bar, goes out of scope after the statement is finished.