Index: uspace/lib/cpp/include/impl/functional.hpp
===================================================================
--- uspace/lib/cpp/include/impl/functional.hpp	(revision e9f2f4e228c204f7af951d7c8822da6ebf45a451)
+++ uspace/lib/cpp/include/impl/functional.hpp	(revision daef596e7da9c68c8b9a6b33dd996a2452436ef4)
@@ -1123,5 +1123,28 @@
     namespace aux
     {
-        template<class F, class... Args>
+        /**
+         * Note: Our internal bind return type has an extra type
+         *       template parameter and an extra bool template parameter.
+         *       We use this for the special version of bind that has
+         *       the return type to have a result_type typedef
+         *       (i.e. when the bool is true, the extra type parameter
+         *       is typedefed as result_type - see the structure below).
+         *       This is just a simplification of the implementation
+         *       so that we don't need to have two return types for
+         *       the two bind functions, because unlike function or
+         *       mem_fn, we know exactly when to make the typedef.
+         */
+
+        template<class, bool = false>
+        struct bind_conditional_result_type
+        { /* DUMMY BODY */ };
+
+        template<class R>
+        struct bind_conditional_result_type<R, true>
+        {
+            using result_type = R;
+        };
+
+        template<class, bool, class, class...>
         class bind_t;
 
@@ -1162,6 +1185,6 @@
                 }
 
-                template<class F, class... BindArgs>
-                constexpr decltype(auto) operator[](const bind_t<F, BindArgs...> b)
+                template<class R, bool B, class F, class... BindArgs>
+                constexpr decltype(auto) operator[](const bind_t<R, B, F, BindArgs...> b)
                 {
                     return b; // TODO: bind subexpressions
@@ -1173,8 +1196,7 @@
         };
 
-        template<class F, class... Args>
-        class bind_t
-        {
-            // TODO: conditional typedefs
+        template<class R, bool HasResultType, class F, class... Args>
+        class bind_t: public bind_conditional_result_type<R, HasResultType>
+        {
             public:
                 template<class G, class... BoundArgs>
@@ -1228,20 +1250,19 @@
     { /* DUMMY BODY */ };
 
-    template<class F, class... Args>
-    struct is_bind_expression<aux::bind_t<F, Args...>>
+    template<class R, bool B, class F, class... Args>
+    struct is_bind_expression<aux::bind_t<R, B, F, Args...>>
         : true_type
     { /* DUMMY BODY */ };
 
     template<class F, class... Args>
-    aux::bind_t<F, Args...> bind(F&& f, Args&&... args)
-    {
-        return aux::bind_t<F, Args...>{forward<F>(f), forward<Args>(args)...};
+    aux::bind_t<void, false, F, Args...> bind(F&& f, Args&&... args)
+    {
+        return aux::bind_t<void, false, F, Args...>{forward<F>(f), forward<Args>(args)...};
     }
 
     template<class R, class F, class... Args>
-    aux::bind_t<F, Args...> bind(F&& f, Args&&... args)
-    {
-        // TODO: this one should have a result_type typedef equal to R
-        return aux::bind_t<F, Args...>{forward<F>(f), forward<Args>(args)...};
+    aux::bind_t<R, true, F, Args...> bind(F&& f, Args&&... args)
+    {
+        return aux::bind_t<R, true, F, Args...>{forward<F>(f), forward<Args>(args)...};
     }
 
