https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101923
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- We can do better than just making the swap conditional: function(function&& __x) noexcept : _Function_base(), _M_invoker(__x._M_invoker) { if (static_cast<bool>(__x)) { _M_functor = __x._M_functor; _M_manager = __x._M_manager; __x._M_manager = nullptr; __x._M_invoker = nullptr; } }