diff --git a/include/dpp/extras.h b/include/dpp/extras.h index 305a59931e..8c3102cfd3 100644 --- a/include/dpp/extras.h +++ b/include/dpp/extras.h @@ -81,7 +81,6 @@ template inline constexpr bool variant_has_v> = (std::is_same_v || ...); struct fun_converter { - // this function is consteval but std::function is unusuable in constexpr - this is intended template constexpr auto operator()(T &&fun) const { using fun_t = std::remove_reference_t; @@ -118,7 +117,10 @@ using function_arg_t = typename function_traits::template arg; */ template dpp::command_completion_event_t if_success(Callable&& on_success) { - if constexpr (variant_has_v, 0>>, dpp::confirmable_t>) { + using arg_t = remove_cvref_t, 0>>; + + static_assert(variant_has_v); // duplicate for nice errors + if constexpr (variant_has_v) { using fn_arg = std::remove_cv_t>>; return [cb = std::forward(on_success)](const dpp::confirmation_callback_t &callback) { @@ -138,8 +140,6 @@ dpp::command_completion_event_t if_success(Callable&& on_success) { } }; } else { - static_assert(!std::is_same_v, void>, "invalid parameter to if_success, type is not a callback type"); - return {}; } }