From 91d2f0b84726624a890e4e5198703ca8732e992e Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Sun, 3 Dec 2023 20:23:06 -0500 Subject: [PATCH] [inplace_vector] remove constexpr, see if that fixes GCC --- include/sg14/inplace_vector.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/sg14/inplace_vector.h b/include/sg14/inplace_vector.h index c727db9..4986c8c 100644 --- a/include/sg14/inplace_vector.h +++ b/include/sg14/inplace_vector.h @@ -93,17 +93,17 @@ struct SG14_INPLACE_VECTOR_TRIVIALLY_RELOCATABLE_IF(std::is_trivially_relocatabl constexpr void set_size_(size_t n) { size_ = n; } constexpr explicit ipvbase() noexcept {} - constexpr ipvbase(const ipvbase& rhs) + ipvbase(const ipvbase& rhs) noexcept(std::is_nothrow_copy_constructible_v) { if constexpr (std::is_trivially_copy_constructible_v) { - std::memmove(this, std::addressof(rhs), sizeof(ipvbase)); + std::memmove((void*)this, (const void*)std::addressof(rhs), sizeof(ipvbase)); } else { std::uninitialized_copy_n(rhs.data_, rhs.size_, data_); size_ = rhs.size_; } } - constexpr ipvbase(ipvbase&& rhs) + ipvbase(ipvbase&& rhs) noexcept(std::is_nothrow_move_constructible_v #if defined(__cpp_lib_trivially_relocatable) || std::is_trivially_relocatable_v @@ -111,7 +111,7 @@ struct SG14_INPLACE_VECTOR_TRIVIALLY_RELOCATABLE_IF(std::is_trivially_relocatabl ) { if constexpr (std::is_trivially_move_constructible_v) { - std::memmove(this, std::addressof(rhs), sizeof(ipvbase)); + std::memmove((void*)this, (const void*)std::addressof(rhs), sizeof(ipvbase)); #if defined(__cpp_lib_trivially_relocatable) } else if constexpr (std::is_trivially_relocatable_v) { std::uninitialized_relocate_n(rhs.data_, rhs.size_, data_); @@ -123,11 +123,11 @@ struct SG14_INPLACE_VECTOR_TRIVIALLY_RELOCATABLE_IF(std::is_trivially_relocatabl size_ = rhs.size_; } } - constexpr void operator=(const ipvbase& rhs) + void operator=(const ipvbase& rhs) noexcept(std::is_nothrow_copy_constructible_v && std::is_nothrow_copy_assignable_v) { if constexpr (std::is_trivially_copy_constructible_v && std::is_trivially_copy_assignable_v && std::is_trivially_destructible_v) { - std::memmove(this, std::addressof(rhs), sizeof(ipvbase)); + std::memmove((void*)this, (const void*)std::addressof(rhs), sizeof(ipvbase)); } else if (this == std::addressof(rhs)) { // do nothing } else if (rhs.size_ <= size_) { @@ -140,11 +140,11 @@ struct SG14_INPLACE_VECTOR_TRIVIALLY_RELOCATABLE_IF(std::is_trivially_relocatabl size_ = rhs.size_; } } - constexpr void operator=(ipvbase&& rhs) + void operator=(ipvbase&& rhs) noexcept(std::is_nothrow_move_constructible_v && std::is_nothrow_move_assignable_v) { if constexpr (std::is_trivially_move_constructible_v && std::is_trivially_move_assignable_v && std::is_trivially_destructible_v) { - std::memmove(this, std::addressof(rhs), sizeof(ipvbase)); + std::memmove((void*)this, (const void*)std::addressof(rhs), sizeof(ipvbase)); } else if (this == std::addressof(rhs)) { // do nothing } else if (rhs.size_ <= size_) { @@ -170,6 +170,7 @@ struct SG14_INPLACE_VECTOR_TRIVIALLY_RELOCATABLE_IF(std::is_trivially_relocatabl ipvbase(ipvbase&&) requires std::is_trivially_move_constructible_v = default; ipvbase& operator=(const ipvbase&) requires std::is_trivially_copy_constructible_v && std::is_trivially_copy_assignable_v && std::is_trivially_destructible_v = default; ipvbase& operator=(ipvbase&&) requires std::is_trivially_move_constructible_v && std::is_trivially_move_assignable_v && std::is_trivially_destructible_v = default; + ~ipvbase() requires std::is_trivially_destructible_v = default; #endif // __cpp_concepts >= 202002L #if __cplusplus >= 202002L