Commit cbca4ccd authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix DistributedMutex build failure under MSVC

Summary:
[Folly] Fix `DistributedMutex` build failure under MSVC, which fails to understand conversion from `std::integral_constant<T, ...>` to `T` in variable template parameter-list contexts.

Fixes #1164.

Reviewed By: aary

Differential Revision: D15819859

fbshipit-source-id: 1a2647e908fd9ad3362c4bea15d64db75a79f95d
parent 3027a430
......@@ -547,14 +547,14 @@ class TaskWithBigReturnValue {
static_assert(sizeof(Waiter::storage_) < sizeof(ReturnType), "");
};
// we need to use std::integral_constant::value here as opposed to
// std::integral_constant::operator T() because MSVC errors out with the
// implicit conversion
template <typename T, typename = std::enable_if_t<true>>
constexpr const auto Sizeof = sizeof(T);
template <typename T>
constexpr const auto Sizeof<T, std::enable_if_t<std::is_void<T>{}>> = 0;
constexpr const auto Sizeof<T, std::enable_if_t<std::is_void<T>::value>> = 0;
// we need to use std::integral_constant::value here as opposed to
// std::integral_constant::operator T() because MSVC errors out with the
// implicit conversion
template <typename Func, typename Waiter>
using CoalescedTask = std::conditional_t<
std::is_void<folly::invoke_result_t<const Func&>>::value,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment