1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Fix C2975 error under MSVC

Apparantly a constexpr value isn't a compile time constant under certain versions of MSVC.
This commit is contained in:
Nathan James 2020-07-25 11:03:59 +01:00
parent 5a6feccd46
commit edd124eebe

View File

@ -587,37 +587,35 @@ TEST(STLExtras, MoveRange) {
}
operator bool() const { return A; }
};
constexpr size_t ItemCount = 4;
SmallVector<Foo, ItemCount> V1, V2, V3, V4;
SmallVector<Foo, 4U> V1, V2, V3, V4;
auto HasVal = [](const Foo &Item) { return static_cast<bool>(Item); };
auto Build = [&] {
SmallVector<Foo, ItemCount> Foos;
Foos.resize(ItemCount);
SmallVector<Foo, 4U> Foos;
Foos.resize(4U);
return Foos;
};
V1.resize(ItemCount);
V1.resize(4U);
EXPECT_TRUE(llvm::all_of(V1, HasVal));
llvm::move(V1, std::back_inserter(V2));
// Ensure input container is same size, but its contents were moved out.
EXPECT_EQ(V1.size(), ItemCount);
EXPECT_EQ(V1.size(), 4U);
EXPECT_TRUE(llvm::none_of(V1, HasVal));
// Ensure output container has the contents of the input container.
EXPECT_EQ(V2.size(), ItemCount);
EXPECT_EQ(V2.size(), 4U);
EXPECT_TRUE(llvm::all_of(V2, HasVal));
llvm::move(std::move(V2), std::back_inserter(V3));
EXPECT_TRUE(llvm::none_of(V2, HasVal));
EXPECT_EQ(V3.size(), ItemCount);
EXPECT_EQ(V3.size(), 4U);
EXPECT_TRUE(llvm::all_of(V3, HasVal));
llvm::move(Build(), std::back_inserter(V4));
EXPECT_EQ(V4.size(), ItemCount);
EXPECT_EQ(V4.size(), 4U);
EXPECT_TRUE(llvm::all_of(V4, HasVal));
}
} // namespace