From: Radosław Zarzyński Date: Wed, 26 Jul 2023 10:42:45 +0000 (+0200) Subject: crimson/ertr: assert on invocability of func provided to safe_then() X-Git-Tag: v19.0.0~585^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=83687f2cc86897d60a460575a7ab2acbd2f9170c;p=ceph.git crimson/ertr: assert on invocability of func provided to safe_then() The goal is to fail with an easier-to-understand error on failed `static_assert()` than cryptic template substitution errors when the function provided to e.g. `safe_then()` doesn't match the type carried within an errorated future. Signed-off-by: Radosław Zarzyński --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index 705a9f05210ce..c5d63d5b9c1d5 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -599,7 +599,9 @@ private: static_assert((... && std::is_invocable_v), "provided Error Visitor is not exhaustive"); - + static_assert(std::is_void_v ? std::is_invocable_v + : std::is_invocable_v, + "Value Func is not invocable with future's value"); using value_func_result_t = typename std::conditional_t, std::invoke_result,