[ 
https://issues.apache.org/jira/browse/MESOS-7907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16137121#comment-16137121
 ] 

Yan Xu commented on MESOS-7907:
-------------------------------

[~mcypark] [[email protected]] according to your slack chat this is a 
regression? Is this allowed before 
https://github.com/apache/mesos/commit/f8e4f11e796b2b0d9bd101a7eb6f106e72cbaee1?

> `async` fails to accept mutable lambdas
> ---------------------------------------
>
>                 Key: MESOS-7907
>                 URL: https://issues.apache.org/jira/browse/MESOS-7907
>             Project: Mesos
>          Issue Type: Bug
>          Components: libprocess
>            Reporter: James Peach
>
> {{process::async}} fails to compile when you pass it a mutable lambda.
> For example:
> {code}
> diff --git a/3rdparty/libprocess/src/tests/process_tests.cpp 
> b/3rdparty/libprocess/src/tests/process_tests.cpp
> index 8d3660070..399462fc2 100644
> --- a/3rdparty/libprocess/src/tests/process_tests.cpp
> +++ b/3rdparty/libprocess/src/tests/process_tests.cpp
> @@ -1464,6 +1464,9 @@ TEST(ProcessTest, THREADSAFE_Async)
>    // Non-void function that returns a future.
>    EXPECT_EQ("42", async(&itoa1, &i).get().get());
> +
> +  int value = 99;
> +  EXPECT_EQ(99, async([value] mutable { return value; }));
>  }
> {code}
> Generates this compilation error:
> {noformat}
> In file included from 
> ../../../3rdparty/libprocess/src/tests/process_tests.cpp:32:0:
> ../../../3rdparty/libprocess/include/process/async.hpp: In instantiation of 
> ‘typename std::result_of<F()>::type 
> process::AsyncExecutorProcess::execute(const F&) [with F = 
> ProcessTest_THREADSAFE_Async_Test::TestBody()::<lambda()>; typename 
> std::enable_if<(! std::is_void<typename std::result_of<F()>::type>::value), 
> int>::type <anonymous> = 0; typename std::result_of<F()>::type = int]’:
> ../../../3rdparty/libprocess/include/process/async.hpp:184:74:   required 
> from ‘process::Future<typename std::result_of<F()>::type> 
> process::AsyncExecutor::execute(const F&, typename std::enable_if<(! 
> std::is_void<typename std::result_of<F()>::type>::value)>::type*) [with F = 
> ProcessTest_THREADSAFE_Async_Test::TestBody()::<lambda()>; typename 
> std::result_of<F()>::type = int; typename std::enable_if<(! 
> std::is_void<typename std::result_of<F()>::type>::value)>::type = void]’
> ../../../3rdparty/libprocess/include/process/async.hpp:242:35:   required 
> from ‘process::Future<typename std::result_of<F()>::type> 
> process::async(const F&, typename std::enable_if<(! std::is_void<typename 
> std::result_of<F()>::type>::value)>::type*) [with F = 
> ProcessTest_THREADSAFE_Async_Test::TestBody()::<lambda()>; typename 
> std::result_of<F()>::type = int; typename std::enable_if<(! 
> std::is_void<typename std::result_of<F()>::type>::value)>::type = void]’
> ../../../3rdparty/libprocess/src/tests/process_tests.cpp:1469:3:   required 
> from here
> ../../../3rdparty/libprocess/include/process/async.hpp:87:13: error: no match 
> for call to ‘(const 
> ProcessTest_THREADSAFE_Async_Test::TestBody()::<lambda()>) ()’
>      return f();
>             ~^~
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to