From df6d471e082be5b041c1edba2ebf1a00a6c92ca0 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 6 Jul 2021 18:36:08 +0300 Subject: [PATCH] hasher: More picky noexcept marking of feed_hash() Commit 5adb8e555c marked the ::feed_hash() and a visitor lambda of digester::feed_hash() as noexcept. This was quite recklesl as the appending_hash<>::operator()s called by ::feed_hash() are not all marked noexcept. In particular, the appending_hash() is not such and seem to throw. The original intent of the mentioned commit was to facilitate the partition_hasher in repair/ code. The hasher itself had been removed by the 0af7a22c21, so it no longer needs the feed_hash-s to be noexcepts. The fix is to inherit noexcept from the called hashers, but for the digester::feed_hash part the noexcept is just removed until clang compilation bug #50994 is fixed. fixes: #8983 tests: unit(dev) Signed-off-by: Pavel Emelyanov Message-Id: <20210706153608.4299-1-xemul@scylladb.com> (cherry picked from commit 63a2fed5850fd4d2bdde5a39394d61a79a70e9c1) --- digester.hh | 3 ++- hashing.hh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/digester.hh b/digester.hh index 012e96e6e5..9f626456fc 100644 --- a/digester.hh +++ b/digester.hh @@ -58,7 +58,8 @@ public: template void feed_hash(const T& value, Args&&... args) { - std::visit([&] (auto& hasher) noexcept -> void { + // FIXME uncomment the noexcept marking once clang bug 50994 is fixed or gcc compilation is turned on + std::visit([&] (auto& hasher) /* noexcept(noexcept(::feed_hash(hasher, value, args...))) */ -> void { ::feed_hash(hasher, value, std::forward(args)...); }, _impl); }; diff --git a/hashing.hh b/hashing.hh index 57d29074d7..650529ed39 100644 --- a/hashing.hh +++ b/hashing.hh @@ -62,7 +62,7 @@ struct appending_hash; template requires Hasher inline -void feed_hash(H& h, const T& value, Args&&... args) noexcept { +void feed_hash(H& h, const T& value, Args&&... args) noexcept(noexcept(std::declval>()(h, value, args...))) { appending_hash()(h, value, std::forward(args)...); };