Mark a few constexpr locals in ThreadLocalTest as static
authorChristopher Dykes <cdykes@fb.com>
Wed, 16 Nov 2016 21:20:32 +0000 (13:20 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 16 Nov 2016 21:24:54 +0000 (13:24 -0800)
Summary:
Because, as discussed in past diffs, MSVC currently requires them to be static in order to resolve them from within the scope of a lambda when they aren't captured.
The only one that actually needs to be marked as `static` is `numReps`, but I like consistency, so I marked them all as static.

Reviewed By: yfeldblum

Differential Revision: D4191610

fbshipit-source-id: 7246170f30551d2079b4373eefbf3d02aab6dfa9

folly/test/ThreadLocalTest.cpp

index e333913e2ac498c67909e389877205800842a358..db163e5f3239a9c674fed3324f4e97391902744d 100644 (file)
@@ -416,11 +416,11 @@ class FillObject {
 
 #if FOLLY_HAVE_STD_THIS_THREAD_SLEEP_FOR
 TEST(ThreadLocal, Stress) {
-  constexpr size_t numFillObjects = 250;
+  static constexpr size_t numFillObjects = 250;
   std::array<ThreadLocalPtr<FillObject>, numFillObjects> objects;
 
-  constexpr size_t numThreads = 32;
-  constexpr size_t numReps = 20;
+  static constexpr size_t numThreads = 32;
+  static constexpr size_t numReps = 20;
 
   std::vector<std::thread> threads;
   threads.reserve(numThreads);