Don't allow Future::onError([](exception_wrapper&){}) to compile
authorSargun Vohra <sargunv@fb.com>
Mon, 7 Aug 2017 20:29:40 +0000 (13:29 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 7 Aug 2017 20:39:35 +0000 (13:39 -0700)
Summary: `Future::onError` does not work with a function that takes `exception_wrapper&`, so it should not compile. `exception_wrapper`, `const exception_wrapper&`, and `exception_wrapper&&` are unaffected.

Reviewed By: yfeldblum

Differential Revision: D5556083

fbshipit-source-id: 45d096d9fee00322eeec6b9b9b1dcbef55cced03

folly/futures/Future-inl.h
folly/futures/Future.h

index ef3048f473ffb7221b81b8a30fa9d06d7da25be6..6ba9b241e942f40fdd6fabe82f70e5008cc10f03 100644 (file)
@@ -366,6 +366,7 @@ template <class T>
 template <class F>
 typename std::enable_if<
     !futures::detail::callableWith<F, exception_wrapper>::value &&
+        !futures::detail::callableWith<F, exception_wrapper&>::value &&
         !futures::detail::Extract<F>::ReturnsFuture::value,
     Future<T>>::type
 Future<T>::onError(F&& func) {
@@ -398,6 +399,7 @@ template <class T>
 template <class F>
 typename std::enable_if<
     !futures::detail::callableWith<F, exception_wrapper>::value &&
+        !futures::detail::callableWith<F, exception_wrapper&>::value &&
         futures::detail::Extract<F>::ReturnsFuture::value,
     Future<T>>::type
 Future<T>::onError(F&& func) {
index babaeb1389994a86b307cdacc2de875615efb50d..2d5d4cbc44fa79aa0ea8370df5d78c755e9a7cf1 100644 (file)
@@ -262,6 +262,7 @@ class Future {
   template <class F>
   typename std::enable_if<
       !futures::detail::callableWith<F, exception_wrapper>::value &&
+          !futures::detail::callableWith<F, exception_wrapper&>::value &&
           !futures::detail::Extract<F>::ReturnsFuture::value,
       Future<T>>::type
   onError(F&& func);
@@ -270,6 +271,7 @@ class Future {
   template <class F>
   typename std::enable_if<
       !futures::detail::callableWith<F, exception_wrapper>::value &&
+          !futures::detail::callableWith<F, exception_wrapper&>::value &&
           futures::detail::Extract<F>::ReturnsFuture::value,
       Future<T>>::type
   onError(F&& func);