From 3c001a310e3339a99c386f4db4f68098257222a5 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Mon, 21 Jul 2014 14:10:43 -0700 Subject: [PATCH] Fix a folly build failure under clang: FutexTest.cpp. Summary: [Folly] Fix a folly build failure under clang: FutexTest.cpp. In clang-v3.4, there is a bug with the combination of a lambda expression inside a function template taking a template name (rather than a type name) as a template argument. This diff, in the interest of building folly under clang-v3.4, extracts the lambda expression into a separate function so that the function template taking a template name as a template argument no longer has a lambda expression in it. Test Plan: Build folly/test/FutexTest.cpp under clang. Reviewed By: njormrod@fb.com Subscribers: mathieubaudet, dougw FB internal diff: D1446237 Tasks: 4723132 --- folly/test/FutexTest.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/folly/test/FutexTest.cpp b/folly/test/FutexTest.cpp index eff4d14b..d920b1e7 100644 --- a/folly/test/FutexTest.cpp +++ b/folly/test/FutexTest.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -31,6 +32,12 @@ using namespace std::chrono; typedef DeterministicSchedule DSched; +template class Atom> +void run_basic_thread( + Futex& f) { + EXPECT_TRUE(f.futexWait(0)); +} + template class Atom> void run_basic_tests() { Futex f(0); @@ -38,9 +45,7 @@ void run_basic_tests() { EXPECT_FALSE(f.futexWait(1)); EXPECT_EQ(f.futexWake(), 0); - auto thr = DSched::thread([&]{ - EXPECT_TRUE(f.futexWait(0)); - }); + auto thr = DSched::thread(std::bind(run_basic_thread, std::ref(f))); while (f.futexWake() != 1) { std::this_thread::yield(); -- 2.34.1