Mark constexpr values needed within non-implicitly-capturing lambdas as static
[folly.git] / folly / Fingerprint.h
index c7a20fb7536c9bdbac27f7382c957496988cd324..74302093b5a58e42bc0d99e37d11426376289566 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -60,10 +60,27 @@ struct FingerprintTable {
 
 template <int BITS>
 const uint64_t FingerprintTable<BITS>::poly[1 + (BITS - 1) / 64] = {};
-
 template <int BITS>
 const uint64_t FingerprintTable<BITS>::table[8][256][1 + (BITS - 1) / 64] = {};
 
+#ifndef _MSC_VER
+// MSVC 2015 can't handle these extern specialization declarations,
+// but they aren't needed for things to work right, so we just don't
+// declare them in the header for MSVC.
+
+#define FOLLY_DECLARE_FINGERPRINT_TABLES(BITS)                      \
+  template <>                                                       \
+  const uint64_t FingerprintTable<BITS>::poly[1 + (BITS - 1) / 64]; \
+  template <>                                                       \
+  const uint64_t FingerprintTable<BITS>::table[8][256][1 + (BITS - 1) / 64]
+
+FOLLY_DECLARE_FINGERPRINT_TABLES(64);
+FOLLY_DECLARE_FINGERPRINT_TABLES(96);
+FOLLY_DECLARE_FINGERPRINT_TABLES(128);
+
+#undef FOLLY_DECLARE_FINGERPRINT_TABLES
+#endif
+
 } // namespace detail
 
 /**