From: Lee Howes Date: Fri, 3 Nov 2017 17:16:04 +0000 (-0700) Subject: Missing Future/SemiFuture->Value conversion check X-Git-Tag: v2017.11.06.00~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=514d9cb9da57bbeffbcd47a3f0bbed6b80b36e33;p=folly.git Missing Future/SemiFuture->Value conversion check Summary: Conversion check was lost in an earlier refactor. This meant that SemiFuture could be accidentally converted to Future through the value constructor. This should be disabled. Reviewed By: yfeldblum Differential Revision: D6214526 fbshipit-source-id: 3fc2d026ec6062b38b9500c8adf3eee12c0f2693 --- diff --git a/folly/futures/Future-pre.h b/folly/futures/Future-pre.h index 26d9c7c6..82a8684c 100644 --- a/folly/futures/Future-pre.h +++ b/folly/futures/Future-pre.h @@ -35,11 +35,6 @@ struct isSemiFuture> : std::true_type { typedef T Inner; }; -template -struct isSemiFuture> : std::true_type { - typedef T Inner; -}; - template struct isFuture : std::false_type { using Inner = typename Unit::Lift::type; diff --git a/folly/futures/Future.h b/folly/futures/Future.h index 5cd5436d..e6fc8ebe 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -209,7 +209,8 @@ class SemiFuture : private futures::detail::FutureBase { template < class T2 = T, typename = typename std::enable_if< - !isFuture::type>::value>::type> + !isFuture::type>::value && + !isSemiFuture::type>::value>::type> /* implicit */ SemiFuture(T2&& val) : Base(std::forward(val)) {} template @@ -343,7 +344,8 @@ class Future : private futures::detail::FutureBase { template < class T2 = T, typename = typename std::enable_if< - !isFuture::type>::value>::type> + !isFuture::type>::value && + !isSemiFuture::type>::value>::type> /* implicit */ Future(T2&& val) : Base(std::forward(val)) {} template