[libcxx-commits] [libcxx] fb03ce7 - [libc++] Fix test for vector data_const.pass.cpp (#122085)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 9 08:22:50 PST 2025
Author: LoS
Date: 2025-01-09T11:22:46-05:00
New Revision: fb03ce7aadd997486e2709051290756e09ad3d01
URL: https://github.com/llvm/llvm-project/commit/fb03ce7aadd997486e2709051290756e09ad3d01
DIFF: https://github.com/llvm/llvm-project/commit/fb03ce7aadd997486e2709051290756e09ad3d01.diff
LOG: [libc++] Fix test for vector data_const.pass.cpp (#122085)
The test contained some non-const accesses when we're really trying to test
that the method is const.
Added:
Modified:
libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
index 885caf272afbf2..0cf0b22047352e 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
@@ -39,7 +39,7 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(is_contiguous_container_asan_correct(v));
}
{
- std::vector<Nasty> v(100);
+ const std::vector<Nasty> v(100);
assert(v.data() == std::addressof(v.front()));
assert(is_contiguous_container_asan_correct(v));
}
@@ -55,7 +55,7 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(is_contiguous_container_asan_correct(v));
}
{
- std::vector<Nasty, min_allocator<Nasty>> v(100);
+ const std::vector<Nasty, min_allocator<Nasty>> v(100);
assert(v.data() == std::addressof(v.front()));
assert(is_contiguous_container_asan_correct(v));
}
@@ -70,7 +70,7 @@ TEST_CONSTEXPR_CXX20 bool tests()
assert(is_contiguous_container_asan_correct(v));
}
{
- std::vector<Nasty, safe_allocator<Nasty>> v(100);
+ const std::vector<Nasty, safe_allocator<Nasty>> v(100);
assert(v.data() == std::addressof(v.front()));
assert(is_contiguous_container_asan_correct(v));
}
More information about the libcxx-commits
mailing list