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
#include <folly/test/DeterministicSchedule.h>
#include <chrono>
+#include <functional>
#include <thread>
#include <gflags/gflags.h>
typedef DeterministicSchedule DSched;
+template <template<typename> class Atom>
+void run_basic_thread(
+ Futex<Atom>& f) {
+ EXPECT_TRUE(f.futexWait(0));
+}
+
template <template<typename> class Atom>
void run_basic_tests() {
Futex<Atom> f(0);
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<Atom>, std::ref(f)));
while (f.futexWake() != 1) {
std::this_thread::yield();