Pass Try by rvalue ref in onError implementation
[folly.git] / folly / Function.h
index 5f0d748cf5656f90ea7a242d47572d9b7aa5b6ce..263b0af07d8ac940b186038dd9bbd5c9e4b436df 100644 (file)
@@ -791,7 +791,11 @@ class FunctionRef<ReturnType(Args...)> final {
   /**
    * Construct a FunctionRef from a reference to a callable object.
    */
-  template <typename Fun>
+  template <
+      typename Fun,
+      typename std::enable_if<
+          !std::is_same<FunctionRef, typename std::decay<Fun>::type>::value,
+          int>::type = 0>
   /* implicit */ FunctionRef(Fun&& fun) noexcept {
     using ReferencedType = typename std::remove_reference<Fun>::type;