accu2017_course-master/Channels$ g++ -std=c++17 channel01.cpp -ochannel01.cpp g++: fatal error: input file ‘channel01.cpp’ is the same as output file compilation terminated. marco@PC:~/CplusplusGoodCodeExamples/accu2017_course-master/Channels$ g++ -std=c++17 channel01.cpp -ochannel01 In file included from channel01.cpp:1:0: /usr/include/stlab/concurrency/channel.hpp: In member function ‘void stlab::v1::detail::shared_process::remove_receiver()’: /usr/include/stlab/concurrency/channel.hpp:726:9: error: there are no arguments to ‘assert’ that depend on a template parameter, so a declaration of ‘assert’ must be available [-fpermissive] assert(_receiver_count > 0); ^~~~~~ /usr/include/stlab/concurrency/channel.hpp:726:9: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) /usr/include/stlab/concurrency/channel.hpp: In member function ‘void stlab::v1::detail::shared_process::task_done()’: /usr/include/stlab/concurrency/channel.hpp:751:9: error: there are no arguments to ‘assert’ that depend on a template parameter, so a declaration of ‘assert’ must be available [-fpermissive] assert(!(do_run && do_final) && "ERROR (sparent) : can't run and close at the same time."); ^~~~~~ /usr/include/stlab/concurrency/channel.hpp: In member function ‘void stlab::v1::detail::shared_process::clear_to_send()’: /usr/include/stlab/concurrency/channel.hpp:774:13: error: there are no arguments to ‘assert’ that depend on a template parameter, so a declaration of ‘assert’ must be available [-fpermissive] assert(_process_suspend_count > 0 && "Error: Try to unsuspend, but not suspended!"); ^~~~~~ /usr/include/stlab/concurrency/channel.hpp:776:13: error: there are no arguments to ‘assert’ that depend on a template parameter, so a declaration of ‘assert’ must be available [-fpermissive] assert(_process_running && "ERROR (sparent) : clear_to_send but not running!"); ^~~~~~ /usr/include/stlab/concurrency/channel.hpp: In member function ‘void stlab::v1::detail::shared_process::broadcast(A&& ...)’: /usr/include/stlab/concurrency/channel.hpp:997:9: error: there are no arguments to ‘assert’ that depend on a template parameter, so a declaration of ‘assert’ must be available [-fpermissive] assert(_process_suspend_count == 0 && "broadcasting while suspended"); ^~~~~~ In file included from /usr/include/c++/7/bits/node_handle.h:39:0, from /usr/include/c++/7/bits/hashtable.h:37, from /usr/include/c++/7/unordered_map:47, from /usr/include/c++/7/functional:60, from /usr/include/stlab/concurrency/executor_base.hpp:13, from /usr/include/stlab/concurrency/channel.hpp:22, from channel01.cpp:1: /usr/include/c++/7/optional: In instantiation of ‘struct std::_Optional_payload&, true, true>’: /usr/include/c++/7/optional:423:30: required from ‘class std::_Optional_base&>’ /usr/include/c++/7/optional:451:11: required from ‘class std::optional&>’ /usr/include/stlab/concurrency/channel.hpp:675:32: required from ‘struct stlab::v1::detail::shared_process, main()::&, void, int>’ /usr/include/c++/7/type_traits:1532:45: required by substitution of ‘template static std::true_type std::__is_convertible_helper, main()::&, void, int>*, stlab::v1::detail::shared_process_sender*, false>::__test<_From1, _To1, >(int) [with _From1 = stlab::v1::detail::shared_process, main()::&, void, int>*; _To1 = stlab::v1::detail::shared_process_sender*; = ]’ /usr/include/c++/7/type_traits:1541:42: [ skipping 10 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/c++/7/type_traits:1081:12: required from ‘struct std::__is_direct_constructible, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/type_traits:1121:12: required from ‘struct std::__is_constructible_impl, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/type_traits:1132:12: required from ‘struct std::is_constructible, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/bits/shared_ptr.h:525:9: required by substitution of ‘template template using _Constructible = typename std::enable_if, _Arg>::value>::type [with _Arg = const std::shared_ptr, main()::&, void, int> >&; _Tp = stlab::v1::detail::shared_process_sender]’ /usr/include/c++/7/bits/shared_ptr.h:536:9: required by substitution of ‘template std::weak_ptr >::weak_ptr(const std::shared_ptr<_Tp>&) [with _Yp = stlab::v1::detail::shared_process, main()::&, void, int>; = ]’ /usr/include/stlab/concurrency/channel.hpp:1360:17: required from ‘auto stlab::v1::receiver< >::operator|(F&&) const [with F = main()::&; T = int]’ channel01.cpp:18:16: required from here /usr/include/c++/7/optional:135:17: error: ‘constexpr std::_Optional_payload<_Tp, , >::_Optional_payload(std::_Optional_payload<_Tp, , >::__ctor_tag, _Tp&&) [with _Tp = main()::&; bool = true; bool = true]’ cannot be overloaded constexpr _Optional_payload(__ctor_tag, _Tp&& __other) ^~~~~~~~~~~~~~~~~ /usr/include/c++/7/optional:125:17: error: with ‘constexpr std::_Optional_payload<_Tp, , >::_Optional_payload(std::_Optional_payload<_Tp, , >::__ctor_tag, const _Tp&) [with _Tp = main()::&; bool = true; bool = true]’ constexpr _Optional_payload(__ctor_tag, ^~~~~~~~~~~~~~~~~ /usr/include/c++/7/optional: In instantiation of ‘union std::_Optional_payload&, true, true>::’: /usr/include/c++/7/optional:158:7: required from ‘struct std::_Optional_payload&, true, true>’ /usr/include/c++/7/optional:423:30: required from ‘class std::_Optional_base&>’ /usr/include/c++/7/optional:451:11: required from ‘class std::optional&>’ /usr/include/stlab/concurrency/channel.hpp:675:32: required from ‘struct stlab::v1::detail::shared_process, main()::&, void, int>’ /usr/include/c++/7/type_traits:1532:45: [ skipping 11 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/c++/7/type_traits:1081:12: required from ‘struct std::__is_direct_constructible, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/type_traits:1121:12: required from ‘struct std::__is_constructible_impl, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/type_traits:1132:12: required from ‘struct std::is_constructible, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/bits/shared_ptr.h:525:9: required by substitution of ‘template template using _Constructible = typename std::enable_if, _Arg>::value>::type [with _Arg = const std::shared_ptr, main()::&, void, int> >&; _Tp = stlab::v1::detail::shared_process_sender]’ /usr/include/c++/7/bits/shared_ptr.h:536:9: required by substitution of ‘template std::weak_ptr >::weak_ptr(const std::shared_ptr<_Tp>&) [with _Yp = stlab::v1::detail::shared_process, main()::&, void, int>; = ]’ /usr/include/stlab/concurrency/channel.hpp:1360:17: required from ‘auto stlab::v1::receiver< >::operator|(F&&) const [with F = main()::&; T = int]’ channel01.cpp:18:16: required from here /usr/include/c++/7/optional:160:24: error: non-static data member ‘std::_Optional_payload&, true, true>::::_M_payload’ in a union may not have reference type ‘std::_Optional_payload&, true, true>::_Stored_type {aka main()::&}’ _Stored_type _M_payload; ^~~~~~~~~~ /usr/include/c++/7/optional: In instantiation of ‘class std::optional&>’: /usr/include/stlab/concurrency/channel.hpp:675:32: required from ‘struct stlab::v1::detail::shared_process, main()::&, void, int>’ /usr/include/c++/7/type_traits:1532:45: required by substitution of ‘template static std::true_type std::__is_convertible_helper, main()::&, void, int>*, stlab::v1::detail::shared_process_sender*, false>::__test<_From1, _To1, >(int) [with _From1 = stlab::v1::detail::shared_process, main()::&, void, int>*; _To1 = stlab::v1::detail::shared_process_sender*; = ]’ /usr/include/c++/7/type_traits:1541:42: required from ‘struct std::__is_convertible_helper, main()::&, void, int>*, stlab::v1::detail::shared_process_sender*, false>’ /usr/include/c++/7/type_traits:1547:12: required from ‘struct std::is_convertible, main()::&, void, int>*, stlab::v1::detail::shared_process_sender*>’ /usr/include/c++/7/bits/shared_ptr_base.h:881:12: [ skipping 8 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/c++/7/type_traits:1081:12: required from ‘struct std::__is_direct_constructible, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/type_traits:1121:12: required from ‘struct std::__is_constructible_impl, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/type_traits:1132:12: required from ‘struct std::is_constructible, (__gnu_cxx::_Lock_policy)2>, const std::shared_ptr, main()::&, void, int> >&>’ /usr/include/c++/7/bits/shared_ptr.h:525:9: required by substitution of ‘template template using _Constructible = typename std::enable_if, _Arg>::value>::type [with _Arg = const std::shared_ptr, main()::&, void, int> >&; _Tp = stlab::v1::detail::shared_process_sender]’ /usr/include/c++/7/bits/shared_ptr.h:536:9: required by substitution of ‘template std::weak_ptr >::weak_ptr(const std::shared_ptr<_Tp>&) [with _Yp = stlab::v1::detail::shared_process, main()::&, void, int>; = ]’ /usr/include/stlab/concurrency/channel.hpp:1360:17: required from ‘auto stlab::v1::receiver< >::operator|(F&&) const [with F = main()::&; T = int]’ channel01.cpp:18:16: required from here /usr/include/c++/7/optional:465:7: error: static assertion failed: Invalid instantiation of optional static_assert(__and_<__not_, nullopt_t>>, ^~~~~~~~~~~~~ /usr/include/c++/7/optional:690:7: error: forming pointer to reference type ‘main()::&’ operator->() const ^~~~~~~~ /usr/include/c++/7/optional:694:7: error: forming pointer to reference type ‘main()::&’ operator->() ^~~~~~~~ In file included from channel01.cpp:1:0: /usr/include/stlab/concurrency/channel.hpp: In instantiation of ‘void stlab::v1::detail::shared_process::clear_to_send() [with Q = stlab::v1::detail::default_queue_strategy; T = stlab::v1::identity; R = int; Args = {int}]’: channel01.cpp:27:1: required from here /usr/include/stlab/concurrency/channel.hpp:774:19: error: ‘assert’ was not declared in this scope assert(_process_suspend_count > 0 && "Error: Try to unsuspend, but not suspended!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:774:19: note: suggested alternative: ‘tzset’ assert(_process_suspend_count > 0 && "Error: Try to unsuspend, but not suspended!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tzset /usr/include/stlab/concurrency/channel.hpp:776:19: error: ‘assert’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] assert(_process_running && "ERROR (sparent) : clear_to_send but not running!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:774:19: note: ‘assert’ declared here, later in the translation unit assert(_process_suspend_count > 0 && "Error: Try to unsuspend, but not suspended!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp: In instantiation of ‘void stlab::v1::detail::shared_process::remove_receiver() [with Q = stlab::v1::detail::default_queue_strategy; T = stlab::v1::identity; R = int; Args = {int}]’: channel01.cpp:27:1: required from here /usr/include/stlab/concurrency/channel.hpp:726:15: error: ‘assert’ was not declared in this scope assert(_receiver_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:726:15: note: suggested alternative: ‘tzset’ assert(_receiver_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~ tzset /usr/include/stlab/concurrency/channel.hpp: In instantiation of ‘void stlab::v1::detail::shared_process_sender_indexed::remove_sender() [with Q = stlab::v1::detail::default_queue_strategy; T = stlab::v1::identity; R = int; Arg = int; long unsigned int I = 0; Args = {int}]’: channel01.cpp:27:1: required from here /usr/include/stlab/concurrency/channel.hpp:557:15: error: ‘assert’ was not declared in this scope assert(_shared_process._sender_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:557:15: note: suggested alternative: ‘tzset’ assert(_shared_process._sender_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tzset /usr/include/stlab/concurrency/channel.hpp: In instantiation of ‘void stlab::v1::detail::shared_process::clear_to_send() [with Q = stlab::v1::detail::default_queue_strategy; T = main()::&; R = void; Args = {int}]’: channel01.cpp:27:1: required from here /usr/include/stlab/concurrency/channel.hpp:774:19: error: ‘assert’ was not declared in this scope assert(_process_suspend_count > 0 && "Error: Try to unsuspend, but not suspended!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:774:19: note: suggested alternative: ‘tzset’ assert(_process_suspend_count > 0 && "Error: Try to unsuspend, but not suspended!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tzset /usr/include/stlab/concurrency/channel.hpp:776:19: error: ‘assert’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] assert(_process_running && "ERROR (sparent) : clear_to_send but not running!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:774:19: note: ‘assert’ declared here, later in the translation unit assert(_process_suspend_count > 0 && "Error: Try to unsuspend, but not suspended!"); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp: In instantiation of ‘void stlab::v1::detail::shared_process::remove_receiver() [with Q = stlab::v1::detail::default_queue_strategy; T = main()::&; R = void; Args = {int}]’: channel01.cpp:27:1: required from here /usr/include/stlab/concurrency/channel.hpp:726:15: error: ‘assert’ was not declared in this scope assert(_receiver_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:726:15: note: suggested alternative: ‘tzset’ assert(_receiver_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~ tzset /usr/include/stlab/concurrency/channel.hpp: In instantiation of ‘void stlab::v1::detail::shared_process_sender_indexed::remove_sender() [with Q = stlab::v1::detail::default_queue_strategy; T = main()::&; R = void; Arg = int; long unsigned int I = 0; Args = {int}]’: channel01.cpp:27:1: required from here /usr/include/stlab/concurrency/channel.hpp:557:15: error: ‘assert’ was not declared in this scope assert(_shared_process._sender_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stlab/concurrency/channel.hpp:557:15: note: suggested alternative: ‘tzset’ assert(_shared_process._sender_count > 0); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tzset