From: James Sedgwick Date: Fri, 4 Sep 2015 21:09:39 +0000 (-0700) Subject: fix SharedPromise::setWith X-Git-Tag: deprecate-dynamic-initializer~439 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=63df308347dd7e72573a49d2ad4c9218c97841a5;p=folly.git fix SharedPromise::setWith Summary: was using the renamed/nonexistent makeTryFunction Reviewed By: @elliottneilclark Differential Revision: D2416178 --- diff --git a/folly/futures/SharedPromise-inl.h b/folly/futures/SharedPromise-inl.h index 2c09a2a0..c2f6d454 100644 --- a/folly/futures/SharedPromise-inl.h +++ b/folly/futures/SharedPromise-inl.h @@ -102,7 +102,7 @@ void SharedPromise::setValue(M&& v) { template template void SharedPromise::setWith(F&& func) { - setTry(makeTryFunction(std::forward(func))); + setTry(makeTryWith(std::forward(func))); } template diff --git a/folly/futures/test/SharedPromiseTest.cpp b/folly/futures/test/SharedPromiseTest.cpp index 495526d5..77095b15 100644 --- a/folly/futures/test/SharedPromiseTest.cpp +++ b/folly/futures/test/SharedPromiseTest.cpp @@ -100,3 +100,9 @@ TEST(SharedPromise, moveMove) { p = std::move(p2); p.setValue(std::make_shared(1)); } + +TEST(SharedPromise, setWith) { + SharedPromise p; + p.setWith([]{ return 1; }); + EXPECT_EQ(1, p.getFuture().value()); +}