]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
errorator: don't rely on non-evaluation of static_assert in constexpr branch
authorSamuel Just <sjust@redhat.com>
Mon, 18 May 2020 18:03:36 +0000 (11:03 -0700)
committerSamuel Just <sjust@redhat.com>
Tue, 19 May 2020 16:15:53 +0000 (09:15 -0700)
At least in clang, we appear to fail that static assert even with another
branch taken.  Instead, assert that one of the other conditions is true.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/common/errorator.h

index b7a7c8eff0031e480582119bb1d7c9894e0e9c89..15fffbb0a4165fe50f20d732ac99c26b16f465e3 100644 (file)
@@ -299,7 +299,9 @@ static constexpr auto composer(FuncHead&& head, FuncTail&&... tail) {
                          std::forward<decltype(args)>(args)...);
     } else {
       static_assert(
-        _impl::always_false<FuncHead>::value, "composition is not exhaustive");
+       std::is_invocable_v<FuncHead, decltype(args)...> ||
+       (sizeof...(FuncTail) > 0),
+      "composition is not exhaustive");
     }
   };
 }