Skip to content

Commit

Permalink
Merge pull request #43 from mclow/test-failures.1
Browse files Browse the repository at this point in the history
Address most of the test failures in the lib test suite
  • Loading branch information
cor3ntin authored Oct 9, 2024
2 parents dc374cc + 13b22de commit 12e1ae2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions libcxx/include/__algorithm/swap_ranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

#include <__algorithm/iterator_operations.h>
#include <__config>
#include <__cstddef/byte.h>
#include <__cstddef/size_t.h>
#include <__iterator/iterator_traits.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_trivially_relocatable.h>
#include <__utility/move.h>
#include <__utility/pair.h>

Expand Down
5 changes: 3 additions & 2 deletions libcxx/include/__memory/uninitialized_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <__algorithm/unwrap_iter.h>
#include <__algorithm/unwrap_range.h>
#include <__config>
#include <__functional/operations.h>
#include <__iterator/iterator_traits.h>
#include <__iterator/reverse_iterator.h>
#include <__memory/addressof.h>
Expand All @@ -27,6 +28,7 @@
#include <__type_traits/extent.h>
#include <__type_traits/is_array.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_trivially_assignable.h>
#include <__type_traits/is_trivially_constructible.h>
#include <__type_traits/is_trivially_relocatable.h>
Expand All @@ -37,10 +39,9 @@
#include <__utility/exception_guard.h>
#include <__utility/move.h>
#include <__utility/pair.h>
#include <__utility/unreachable.h>
#include <new>

#include <cassert>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
Expand Down
8 changes: 4 additions & 4 deletions libcxx/include/vector
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ vector<_Tp, _Allocator>::erase(const_iterator __position) {
// destroy the element at __p
__alloc_traits::destroy(__alloc(), std::__to_address(__p));
// move the rest down
(void) relocate(__p + 1, this->__end_, __p);
(void) relocate(std::__to_address(__p + 1), std::__to_address(this->__end_), std::__to_address(__p));
// update the end
this->__end_--;
__annotate_shrink(__old_size);
Expand Down Expand Up @@ -1647,7 +1647,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
if constexpr (is_trivially_relocatable_v<_Tp> || is_nothrow_move_constructible_v<_Tp>) {
// Make space by trivially relocating everything
_ConstructTransaction __tx(*this, 1);
(void) relocate(std::__to_address(__p), std::__to_address(this->__end_), __p + 1);
(void) relocate(std::__to_address(__p), std::__to_address(this->__end_), std::__to_address(__p + 1));
// construct the new element (not assign!)
const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
if (std::__is_pointer_in_range(std::__to_address(__p), std::__to_address(__end_), std::addressof(__x)))
Expand Down Expand Up @@ -1687,7 +1687,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) {
if constexpr (is_trivially_relocatable_v<_Tp> || is_nothrow_move_constructible_v<_Tp>) {
// Make space by trivially relocating everything
_ConstructTransaction __tx(*this, 1);
(void) relocate(std::__to_address(__p), std::__to_address(this->__end_), __p + 1);
(void) relocate(std::__to_address(__p), std::__to_address(this->__end_), std::__to_address(__p + 1));
// construct the new element (not assign!)
__alloc_traits::construct(this->__alloc(), std::__to_address(__p), std::forward<value_type>(__x));
++__tx.__pos_;
Expand Down Expand Up @@ -1722,7 +1722,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) {
if constexpr (is_trivially_relocatable_v<_Tp> || is_nothrow_move_constructible_v<_Tp>) {
// Make space by trivially relocating everything
_ConstructTransaction __tx(*this, 1);
(void) relocate(std::__to_address(__p), std::__to_address(this->__end_), __p + 1);
(void) relocate(std::__to_address(__p), std::__to_address(this->__end_), std::__to_address(__p + 1));
// construct the new element
__alloc_traits::construct(this->__alloc(), std::__to_address(__p), std::forward<_Args>(__args)...);
++__tx.__pos_;
Expand Down

0 comments on commit 12e1ae2

Please sign in to comment.