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<int, 100>'`
2. `FunctionTest.cpp:103:3: error: no matching conversion for functional-style cast from 'Function<int (int)>' to '::testing::AssertionResult'`
The first was a missing `#include <array>`, 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
* limitations under the License.
*/
+#include <array>
#include <cstdarg>
#include <folly/Function.h>
Function<int(int)> 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<int(int)> 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 = {};
Function<int()> f = [] { return 0; };
Function<int()>& g = f;
f = std::move(g);
- EXPECT_TRUE(f);
+ EXPECT_TRUE(bool(f));
}
TEST(Function, DeducableArguments) {