mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Clemmer <>
Subject Review Request 54271: Disambiguate return type of lambda passed to `Future<T>::then`.
Date Thu, 01 Dec 2016 23:46:13 GMT

This is an automatically generated e-mail. To reply, visit:

Review request for mesos, Anand Mazumdar, Benjamin Hindman, and Joseph Wu.

Repository: mesos

Description (updated)

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

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> {


Diffs (updated)

  3rdparty/libprocess/src/http.cpp ac406e2e5c2d9b38ec453a74cf47ee5f80a875df 




Alex Clemmer

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message