Adjust the Function::NonCopyableLambda test to use a large struct rather than a C...
authorChristopher Dykes <cdykes@fb.com>
Thu, 17 Nov 2016 00:41:51 +0000 (16:41 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Thu, 17 Nov 2016 00:53:32 +0000 (16:53 -0800)
Summary:
Because MSVC doesn't like it when you attempt to explicitly capture a c-style array in a lambda capture list.
See: https://developercommunity.visualstudio.com/content/problem/2444/cannot-explicitly-capture-c-style-array-in-lambda.html

Reviewed By: yfeldblum

Differential Revision: D4191400

fbshipit-source-id: 305f8086c29f079ccf2c322f20da6393235bc76d

folly/test/FunctionTest.cpp

index 99c5b6c519767a3bf3eb4a1118d127682049b141..6e49c6142717a98f8f055ce0667ae96963da7b35 100644 (file)
@@ -197,8 +197,10 @@ TEST(Function, NonCopyableLambda) {
   auto unique_ptr_int = folly::make_unique<int>(900);
   EXPECT_EQ(900, *unique_ptr_int);
 
-  char fooData[64] = {0};
-  EXPECT_EQ(0, fooData[0]); // suppress gcc warning about fooData not being used
+  struct {
+    char data[64];
+  } fooData = {{0}};
+  (void)fooData; // suppress gcc warning about fooData not being used
 
   auto functor = std::bind(
       [fooData](std::unique_ptr<int>& up) mutable { return ++*up; },