From: Hannes Roth Date: Thu, 17 Apr 2014 15:49:51 +0000 (-0700) Subject: (Folly/Gen) Fix compilation with clang X-Git-Tag: v0.22.0~595 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d456b584d94f9e5e48b01277d514999e0f461a7f;p=folly.git (Folly/Gen) Fix compilation with clang Summary: Clang chokes because it tries to instantiate both versions of `from`, one of which calls `std::begin(const int*)`, which doesn't work. By casting the intializer list to the right type, it can pick the overload. Clang, because it makes debugging these templates so much better. Test Plan: `fbconfig --clang folly/gen/test && fbmake runtests_dbg` Reviewed By: tjackson@fb.com FB internal diff: D1280888 --- diff --git a/folly/gen/test/BaseTest.cpp b/folly/gen/test/BaseTest.cpp index 6f58e732..06e50f37 100644 --- a/folly/gen/test/BaseTest.cpp +++ b/folly/gen/test/BaseTest.cpp @@ -882,7 +882,7 @@ TEST(Gen, Cycle) { TEST(Gen, Dereference) { { const int x = 4, y = 2; - auto s = from({&x, nullptr, &y}); + auto s = from(std::initializer_list({&x, nullptr, &y})); EXPECT_EQ(6, s | dereference | sum); } {