Skip to content

Commit

Permalink
Closure.h: use static_assert instead of LOG(FATAL)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: a17ebc84d49ce763ffa64c8db0f85638bb5ace63
  • Loading branch information
arseny30 committed Sep 9, 2020
1 parent fdc3920 commit 958b16b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tdutils/td/utils/Closure.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,15 @@ class DelayedClosure {
explicit DelayedClosure(
const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &other,
std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value, int> = 0) {
LOG(FATAL) << "Deleted constructor";
std::abort();
static_assert(std::is_same<FromActorT, FromActorT>::value, "Deleted constructor");
}

template <class FromActorT, class FromFunctionT, class... FromArgsT>
std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value,
DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>>
do_clone(const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &value) const {
LOG(FATAL) << "Trying to clone DelayedClosure that contains noncopyable elements";
std::abort();
static_assert(std::is_same<FromActorT, FromActorT>::value,
"Trying to clone DelayedClosure that contains noncopyable elements");
}

template <class FromActorT, class FromFunctionT, class... FromArgsT>
Expand Down

0 comments on commit 958b16b

Please sign in to comment.