Repository: mesos
Updated Branches:
  refs/heads/master a6157150f -> 800c629a8


Disambiguated return type of lambda passed to `Future<T>::then`.

Fixes build break for OS X 10.10.4, Apple LLVM version 6.1.0
(clang-602.0.53) (based on LLVM 3.6.0svn), introduced by
c33ba209d226fb91874b00976298faf278a29369.

In `process::http::internal::sendfile`, a lambda function is passed to a
call to `Future<T>::then`:

    [=]() mutable {
      // NOTE: the file descriptor gets closed by FileEncoder.
      Encoder* encoder = new FileEncoder(fd.get(), s.st_size);
      return send(socket, encoder)
        .onAny([=]() {
        delete encoder;
        });
    }

This lambda function is intended to return a `Future<Nothing>`, which in
turn is returned by `sendfile` (i.e., `sendfile` is meant to return a
`Future<Nothing>`). But, on the machine specified above, the compiler
infers the type of this lambda to be `Future<Future<Nothing>>`.  This
causes a compiler error, since `sendfile` is supposed to return a plain
old `Future<Nothing>`.

The fix is to simply alter the signature of the labmda to give the
compiler a hint:

    [=]() mutable -> Future<Nothing> {

Review: https://reviews.apache.org/r/54271/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/800c629a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/800c629a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/800c629a

Branch: refs/heads/master
Commit: 800c629a81dea3002ce5b1e1e29f5479813d64eb
Parents: a615715
Author: Alex Clemmer <clemmer.alexan...@gmail.com>
Authored: Thu Dec 1 18:14:16 2016 -0800
Committer: Joseph Wu <josep...@apache.org>
Committed: Thu Dec 1 18:49:43 2016 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/http.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/800c629a/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index ac406e2..dd55034 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -1501,7 +1501,7 @@ Future<Nothing> sendfile(
         os::close(fd.get());
       }
     })
-    .then([=]() mutable {
+    .then([=]() mutable -> Future<Nothing> {
       // NOTE: the file descriptor gets closed by FileEncoder.
       Encoder* encoder = new FileEncoder(fd.get(), s.st_size);
       return send(socket, encoder)

Reply via email to