Commit 00647a8d authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix gcc-specific problem in reentrant_allocator test

Summary:
[Folly] Fix gcc-specific problem in `reentrant_allocator` test.

```
folly/memory/test/ReentrantAllocatorTest.cpp: In member function ‘virtual void ReentrantAllocatorTest_large_Test::TestBody()’:
folly/folly/memory/test/ReentrantAllocatorTest.cpp:68:22: error: no matching function for call to ‘std::vector<ReentrantAllocatorTest_large_Test::TestBody()::type, folly::reentrant_allocator<ReentrantAllocatorTest_large_Test::TestBody()::type> >::push_back(<brace-enclosed initializer list>)’
     vec.push_back(type{i});
                      ^
```

Differential Revision: D19738608

fbshipit-source-id: bbffd1f47749be1aa88bb45bddc401ffca48c4ca
parent 5d4b1cac
...@@ -59,13 +59,15 @@ TEST_F(ReentrantAllocatorTest, small) { ...@@ -59,13 +59,15 @@ TEST_F(ReentrantAllocatorTest, small) {
TEST_F(ReentrantAllocatorTest, large) { TEST_F(ReentrantAllocatorTest, large) {
constexpr size_t const large_size_lg = 6; constexpr size_t const large_size_lg = 6;
struct alignas(1u << large_size_lg) type : std::tuple<size_t> {}; struct alignas(1u << large_size_lg) type : std::tuple<size_t> {
using std::tuple<size_t>::tuple;
};
auto const opts = folly::reentrant_allocator_options{} // auto const opts = folly::reentrant_allocator_options{} //
.large_size_lg(large_size_lg); .large_size_lg(large_size_lg);
folly::reentrant_allocator<void> alloc{opts}; folly::reentrant_allocator<void> alloc{opts};
std::vector<type, folly::reentrant_allocator<type>> vec{alloc}; std::vector<type, folly::reentrant_allocator<type>> vec{alloc};
for (auto i = 0u; i < (1u << 16); ++i) { for (auto i = 0u; i < (1u << 16); ++i) {
vec.push_back(type{i}); vec.push_back({i});
} }
for (auto i = 0u; i < (1u << 16); ++i) { for (auto i = 0u; i < (1u << 16); ++i) {
EXPECT_EQ(i, std::get<0>(vec.at(i))); EXPECT_EQ(i, std::get<0>(vec.at(i)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment