Disable a range test under MSVC
authorChristopher Dykes <cdykes@fb.com>
Fri, 18 Nov 2016 23:07:58 +0000 (15:07 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Fri, 18 Nov 2016 23:08:44 +0000 (15:08 -0800)
Summary: Because, as the comment says, MSVC fails miserably at this, producing errors at compile time.

Reviewed By: yfeldblum

Differential Revision: D4207544

fbshipit-source-id: d9a11b72877d22d3d3fe2e2c862d99601ab21431

folly/test/RangeTest.cpp

index 827e085cd9645d06a8b98f34f6a851d1dafc3bff..cf577f9fa610e80864e83bb270d4cd6d13408208 100644 (file)
@@ -1114,8 +1114,15 @@ TEST(RangeFunc, ConstexprStdArray) {
   static constexpr const std::array<int, 4> numArray = {{3, 17, 1, 9}};
   constexpr const auto numArrayRange = range(numArray);
   EXPECT_EQ(17, numArrayRange[1]);
+  // MSVC 2017 RC and earlier have an issue that causes the beginning and
+  // end of numArrayRange to point to different copies of numArray, causing
+  // this attempt to calculate the size to error at compile time because
+  // they don't point to parts of the same array :(
+  // https://developercommunity.visualstudio.com/content/problem/3216/
+#if !defined(_MSC_VER) || _MSC_VER > 191024629
   constexpr const auto numArrayRangeSize = numArrayRange.size();
   EXPECT_EQ(4, numArrayRangeSize);
+#endif
 }
 
 TEST(RangeFunc, ConstexprStdArrayZero) {