[libcxx] LWG2420 bits for bind<void> - Patch from K-Ballo

Implemented LWG2420 bits for bind<void>

Review: http://reviews.llvm.org/D10997
llvm-svn: 241967
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 2d15f15f285fd0dee552ba7f91bb4daf244cbdf4
diff --git a/include/functional b/include/functional
index 7a9d68d..90972bc 100644
--- a/include/functional
+++ b/include/functional
@@ -2186,12 +2186,13 @@
         typename enable_if
         <
             is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
-                           result_type>::value,
+                           result_type>::value || is_void<_Rp>::value,
             result_type
         >::type
         operator()(_Args&& ...__args)
         {
-            return base::operator()(_VSTD::forward<_Args>(__args)...);
+            typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+            return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
         }
 
     template <class ..._Args>
@@ -2199,12 +2200,13 @@
         typename enable_if
         <
             is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
-                           result_type>::value,
+                           result_type>::value || is_void<_Rp>::value,
             result_type
         >::type
         operator()(_Args&& ...__args) const
         {
-            return base::operator()(_VSTD::forward<_Args>(__args)...);
+            typedef __invoke_void_return_wrapper<_Rp> _Invoker;
+            return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
         }
 };