diff --git a/ttg/ttg/make_tt.h b/ttg/ttg/make_tt.h index f999677d6..5f49edfd8 100644 --- a/ttg/ttg/make_tt.h +++ b/ttg/ttg/make_tt.h @@ -112,7 +112,6 @@ class CallableWrapTTArgs } }; auto unpack_input_tuple_if_needed = [&](auto&&... args){ - static_assert(!funcT_receives_input_tuple); if constexpr (funcT_receives_input_tuple) { return invoke_func_handle_ret(std::forward(args_tuple), std::forward(args)...); } else { @@ -179,6 +178,14 @@ class CallableWrapTTArgs } }; + auto invoke_func_empty_tuple = [&](auto&&... args){ + if constexpr(funcT_receives_input_tuple) { + invoke_func_handle_ret(std::tuple<>{}, std::forward(args)...); + } else { + invoke_func_handle_ret(std::forward(args)...); + } + }; + if constexpr (funcT_receives_outterm_tuple) { invoke_func_handle_ret(out); } else { @@ -204,8 +211,16 @@ class CallableWrapTTArgs } }; + auto invoke_func_empty_tuple = [&](auto&&... args){ + if constexpr(funcT_receives_input_tuple) { + invoke_func_handle_ret(std::tuple<>{}, std::forward(args)...); + } else { + invoke_func_handle_ret(std::forward(args)...); + } + }; + if constexpr (funcT_receives_outterm_tuple) { - return invoke_func_handle_ret(out); + return invoke_func_empty_tuple(out); } else { auto old_output_tls_ptr = this->outputs_tls_ptr_accessor(); this->set_outputs_tls_ptr(); @@ -214,7 +229,7 @@ class CallableWrapTTArgs [this, old_output_tls_ptr](){ this->set_outputs_tls_ptr(old_output_tls_ptr); }); - return invoke_func_handle_ret(); + return invoke_func_empty_tuple(); } } @@ -406,7 +421,7 @@ auto make_tt_tpl(funcT &&func, const std::tuple; using decayed_input_args_t = ttg::meta::decayed_typelist_t; - using wrapT = typename CallableWrapTTArgsAsTypelist::type; static_assert(std::is_same_v>, "ttg::make_tt_tpl(func, inedges, outedges): inedges value types do not match argument types of func"); @@ -425,7 +440,7 @@ auto make_tt_tpl(funcT &&func, const std::tuple &outnames = std::vector(sizeof...(output_edgesT), "output")) { - return make_tt_tpl( + return make_tt_tpl( std::forward(func), inedges, outedges, name, innames, outnames); } // clang-format off