(Folly/Gen) Fix compilation with clang
authorHannes Roth <hannesr@fb.com>
Thu, 17 Apr 2014 15:49:51 +0000 (08:49 -0700)
committerSara Golemon <sgolemon@fb.com>
Fri, 18 Apr 2014 19:04:15 +0000 (12:04 -0700)
Summary:
Clang chokes because it tries to instantiate both versions of `from<const int*>`, 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

folly/gen/test/BaseTest.cpp

index 6f58e732a49c03c911621a8ab56041e425d4e32e..06e50f376014ef964d2dc08d33f00ee84858e0d1 100644 (file)
@@ -882,7 +882,7 @@ TEST(Gen, Cycle) {
 TEST(Gen, Dereference) {
   {
     const int x = 4, y = 2;
-    auto s = from<const int*>({&x, nullptr, &y});
+    auto s = from(std::initializer_list<const int*>({&x, nullptr, &y}));
     EXPECT_EQ(6, s | dereference | sum);
   }
   {