summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/sequences/vector/vector.modifiers
diff options
context:
space:
mode:
authorStephan T. Lavavej <stl@exchange.microsoft.com>2016-10-27 21:25:12 +0000
committerStephan T. Lavavej <stl@exchange.microsoft.com>2016-10-27 21:25:12 +0000
commit50b80c36fab3baae5b51182c7a799cc8eb17bfdd (patch)
treea93c9b58d7497510d6faf1a9124430d66936257f /libcxx/test/std/containers/sequences/vector/vector.modifiers
parentc0de9c9e40b3eb5c2422d72ff5e0e3962baa714b (diff)
downloadbcm5719-llvm-50b80c36fab3baae5b51182c7a799cc8eb17bfdd.tar.gz
bcm5719-llvm-50b80c36fab3baae5b51182c7a799cc8eb17bfdd.zip
[PATCH] D25483: [libcxx] [test] Fix non-Standard assumptions about how many elements are allocated
llvm-svn: 285346
Diffstat (limited to 'libcxx/test/std/containers/sequences/vector/vector.modifiers')
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp5
-rw-r--r--libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
index aa4f83f4120..9a828ce195e 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
@@ -48,7 +48,10 @@ int main()
assert(c[j] == j);
}
{
- std::vector<int, limited_allocator<int, 15> > c;
+ // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
+ // Use 17 for implementations that dynamically allocate a container proxy
+ // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
+ std::vector<int, limited_allocator<int, 17> > c;
c.push_back(0);
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
index c4bc8373f3d..eb9e7b5d0e7 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
@@ -50,7 +50,10 @@ int main()
assert(c[j] == MoveOnly(j));
}
{
- std::vector<MoveOnly, limited_allocator<MoveOnly, 15> > c;
+ // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
+ // Use 17 for implementations that dynamically allocate a container proxy
+ // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 17> > c;
c.push_back(MoveOnly(0));
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
OpenPOWER on IntegriCloud