From: Radoslaw Zarzynski Date: Tue, 10 Sep 2019 16:21:10 +0000 (+0200) Subject: crimson: add more static asserts to errorator. X-Git-Tag: v15.1.0~801^2~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b1203dbed1773b98920fe356e771c4730ac1dafa;p=ceph.git crimson: add more static asserts to errorator. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/common/errorator.h b/src/crimson/common/errorator.h index 19b440a6c2b5..2f52bd8215f6 100644 --- a/src/crimson/common/errorator.h +++ b/src/crimson/common/errorator.h @@ -67,6 +67,8 @@ public: template <_impl::ct_error ErrorV> void operator()(const unthrowable_wrapper& e) { + static_assert(std::is_invocable::value, + "provided Error Visitor is not exhaustive"); // In C++ throwing an exception isn't the sole way to signal // error with it. This approach nicely fits cold, infrequent cases // but when applied to a hot one, it will likely hurt performance. @@ -229,6 +231,11 @@ struct errorator { template auto safe_then(ValueFuncT&& valfunc, ErrorVisitorT&& errfunc) { + static_assert((... && std::is_invocable_v< + ErrorVisitorT, + decltype(WrappedAllowedErrorsT::instance)>), + "provided Error Visitor is not exhaustive"); + using value_func_result_t = std::invoke_result_t; // recognize whether there can be any error coming from the Value // Function.