https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101243
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- For the attachment in comment 3 trunk now says: In file included from /home/jwakely/gcc/12/include/c++/12.0.0/functional:59, from /tmp/pr-1.cc:2: /home/jwakely/gcc/12/include/c++/12.0.0/bits/std_function.h: In instantiation of 'std::function<_Res(_ArgTypes ...)>::function(_Functor&&) [with _Functor = f(f()::_Z1fv.frame*)::<lambda()>; <template-parameter-2-2> = void; _Res = void; _ArgTypes = {}]': /tmp/pr-1.cc:71:13: required from here /home/jwakely/gcc/12/include/c++/12.0.0/bits/std_function.h:442:69: error: static assertion failed: std::function target must be copy-constructible 442 | static_assert(is_copy_constructible<__decay_t<_Functor>>::value, | ^~~~~ /home/jwakely/gcc/12/include/c++/12.0.0/bits/std_function.h:442:69: note: 'std::integral_constant<bool, false>::value' evaluates to false