sapling/eden/fs/store/KeySpace.cpp
Wez Furlong b29f7a1020 eden: fix compilation on latest vs2017
Summary:
vs2017 is not able to compile the static assertion in KeySpace.cpp.
Previously we thought that this would be resolved in a later release of vs2017
but now that is here it is clear that it hasn't been fixed.

This commit pushes the version requirement to vs2019 (see
https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd for a mapping between
product versions and compiler versions), but we cannot build with vs2019
because folly and rangev3 don't compile with vs2019, so this assertion (heh!)
has literally not been tested.

This commit also fixes up an oversight in the gating logic: the intent is that
we perform the assertion on all systems except known broken MSVC.  We were
accidentally restricting it to later versions of MSVC.

Reviewed By: simpkins

Differential Revision: D21432890

fbshipit-source-id: e11ffccc53bf8dffdf2db45ad4f3cf199b1cc70d
2020-05-06 15:05:37 -07:00

35 lines
712 B
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#include "eden/fs/store/KeySpace.h"
namespace facebook {
namespace eden {
// Older versions of MSVC++ ICE on the following code.
#if !defined(_MSC_FULL_VER) || _MSC_FULL_VER >= 192027508
namespace {
constexpr bool assertKeySpaceInvariants() {
size_t index = 0;
for (auto& ks : KeySpace::kAll) {
if (index != ks->index) {
return false;
}
index += 1;
}
return index == KeySpace::kTotalCount;
}
} // namespace
static_assert(assertKeySpaceInvariants());
#endif
} // namespace eden
} // namespace facebook