Don't assume standard library types are relocatable
authorChristopher Dykes <cdykes@fb.com>
Wed, 16 Nov 2016 01:30:09 +0000 (17:30 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 16 Nov 2016 01:38:30 +0000 (17:38 -0800)
Summary: Although currently the only one of these that isn't relocatable is `std::string`, making assumptions about the standard library is a terrible idea, so disable all of them.

Reviewed By: yfeldblum

Differential Revision: D4186024

fbshipit-source-id: 4d2a54d232df0cb05959a8d9cb1a2d2cf34d1302

folly/Traits.h

index ece58c30b60c0e0b9de212479cf4702796f5451e..a78f6e05b9f2e9f310685e30cdc61efbd4de924e 100644 (file)
@@ -578,6 +578,8 @@ constexpr initlist_construct_t initlist_construct{};
 
 } // namespace folly
 
+// Assume nothing when compiling with MSVC.
+#ifndef _MSC_VER
 // gcc-5.0 changed string's implementation in libgcc to be non-relocatable
 #if __GNUC__ < 5
 FOLLY_ASSUME_FBVECTOR_COMPATIBLE_3(std::basic_string)
@@ -591,6 +593,7 @@ FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(std::function)
 
 // Boost
 FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(boost::shared_ptr)
+#endif
 
 #define FOLLY_CREATE_HAS_MEMBER_TYPE_TRAITS(classname, type_name) \
   template <typename T> \