https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102223
--- Comment #1 from Federico Kircheis <federico.kircheis at gmail dot com> --- Sorry, I copied the wrong snippet, it should have been ---- #include <utility> struct s{ s() noexcept; ~s(); int value() const noexcept; }; s foo() noexcept; int bar(){ const auto& v = std::move(foo()); int res = v.value(); return res; } ---- As reference: https://godbolt.org/z/h31Trbsx6