From b9ac551151f55eba2cf3081e98d38715594674a9 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Tue, 1 Nov 2016 16:50:28 -0700 Subject: [PATCH] Don't declare the extern FingerprintTable specializations under MSVC Summary: MSVC doesn't allow uninitialized non-`extern` `const` declarations, but we can't mark them `extern` because they are part of a template specialization. We also can't initialize them, because they'd conflict with the definition specializations in the generated tables. As the forward-declarations aren't required for it to work under MSVC, as the specializations are found appropriately, just don't declare the specializations under MSVC. Reviewed By: yfeldblum Differential Revision: D4098282 fbshipit-source-id: 84b73d63bbe6cf9c54b7fe7a3bfc2488699df7c2 --- folly/Fingerprint.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/folly/Fingerprint.h b/folly/Fingerprint.h index a4400d5d..1294a0d2 100644 --- a/folly/Fingerprint.h +++ b/folly/Fingerprint.h @@ -63,6 +63,11 @@ const uint64_t FingerprintTable::poly[1 + (BITS - 1) / 64] = {}; template const uint64_t FingerprintTable::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::poly[1 + (BITS - 1) / 64]; \ @@ -74,6 +79,7 @@ FOLLY_DECLARE_FINGERPRINT_TABLES(96); FOLLY_DECLARE_FINGERPRINT_TABLES(128); #undef FOLLY_DECLARE_FINGERPRINT_TABLES +#endif } // namespace detail -- 2.34.1