In file included from prog.cpp:1:0:
/usr/include/c++/5/functional: In instantiation of 'static void std::_Function_base::_Base_manager<_Functor>::_M_clone(std::_Any_data&, const std::_Any_data&, std::true_type) [with _Functor = main()::<lambda(int)>; std::true_type = std::integral_constant<bool, true>]':
/usr/include/c++/5/functional:1746:16: required from 'static bool std::_Function_base::_Base_manager<_Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Functor = main()::<lambda(int)>]'
/usr/include/c++/5/functional:2260:19: required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = main()::<lambda(int)>; <template-parameter-2-2> = void; _Res = int; _ArgTypes = {int}]'
prog.cpp:15:63: required from here
/usr/include/c++/5/functional:1702:4: error: use of deleted function 'main()::<lambda(int)>::<lambda>(const main()::<lambda(int)>&)'
new (__dest._M_access()) _Functor(__source._M_access<_Functor>());
^
prog.cpp:15:32: note: 'main()::<lambda(int)>::<lambda>(const main()::<lambda(int)>&)' is implicitly deleted because the default definition would be ill-formed:
MyFunction f{[n{std::move(n)}] (int i) {(void)n; return i; }};
^
prog.cpp:15:32: error: use of deleted function 'no_copy::no_copy(const no_copy&)'
prog.cpp:9:2: note: declared here
no_copy(const no_copy&) = delete;
^