From f70249c03acbf2e0d4449d6e74b8ab6cae206b28 Mon Sep 17 00:00:00 2001 From: Ben Hamilton Date: Fri, 27 May 2016 17:00:50 -0700 Subject: [PATCH] Fix test/FunctionTest.cpp build breaks Summary: The Folly `make check` build is broken with Clang on OS X. This diff fixes two breaks in `test/FunctionTest.cpp`: 1. `FunctionTest.cpp:39:20: error: implicit instantiation of undefined template 'std::__1::array'` 2. `FunctionTest.cpp:103:3: error: no matching conversion for functional-style cast from 'Function' to '::testing::AssertionResult'` The first was a missing `#include `, and the second is a workaround for this gtest bug: https://github.com/google/googletest/issues/429 Reviewed By: djwatson Differential Revision: D3361188 fbshipit-source-id: 8140de978a2cbaf0f4aab45781ce0d656f03202b --- folly/test/FunctionTest.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/folly/test/FunctionTest.cpp b/folly/test/FunctionTest.cpp index 3f138516..1c18e481 100644 --- a/folly/test/FunctionTest.cpp +++ b/folly/test/FunctionTest.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include @@ -100,13 +101,15 @@ TEST(Function, Emptiness_T) { Function g([](int x) { return x + 1; }); EXPECT_NE(g, nullptr); EXPECT_NE(nullptr, g); - EXPECT_TRUE(g); + // Explicitly convert to bool to work around + // https://github.com/google/googletest/issues/429 + EXPECT_TRUE(bool(g)); EXPECT_EQ(100, g(99)); Function h(&func_int_int_add_25); EXPECT_NE(h, nullptr); EXPECT_NE(nullptr, h); - EXPECT_TRUE(h); + EXPECT_TRUE(bool(h)); EXPECT_EQ(125, h(100)); h = {}; @@ -851,7 +854,7 @@ TEST(Function, SelfMoveAssign) { Function f = [] { return 0; }; Function& g = f; f = std::move(g); - EXPECT_TRUE(f); + EXPECT_TRUE(bool(f)); } TEST(Function, DeducableArguments) { -- 2.34.1