fix issue with gp references
parent
0eea2189e3
commit
0dc083e095
|
@ -27,7 +27,7 @@ macro(compile_options target_name)
|
|||
sanitizers(${target_name})
|
||||
endmacro()
|
||||
|
||||
project(blt-gp VERSION 0.4.5)
|
||||
project(blt-gp VERSION 0.4.6)
|
||||
|
||||
include(CTest)
|
||||
|
||||
|
|
|
@ -63,9 +63,10 @@ namespace blt::gp
|
|||
template<typename T>
|
||||
static void call_drop(stack_allocator& read_allocator, const size_t offset)
|
||||
{
|
||||
if constexpr (blt::gp::detail::has_func_drop_v<T>)
|
||||
if constexpr (blt::gp::detail::has_func_drop_v<detail::remove_cv_ref<T>>)
|
||||
{
|
||||
auto [type, ptr] = read_allocator.access_pointer<detail::remove_cv_ref<T>>(offset);
|
||||
// type is not ephemeral, so we must drop it.
|
||||
if (!ptr.bit(0))
|
||||
type.drop();
|
||||
}
|
||||
|
@ -200,7 +201,7 @@ namespace blt::gp
|
|||
|
||||
[[nodiscard]] bool return_has_ephemeral_drop() const
|
||||
{
|
||||
return detail::has_func_drop_v<Return>;
|
||||
return detail::has_func_drop_v<detail::remove_cv_ref<Return>>;
|
||||
}
|
||||
|
||||
operator_id id = -1;
|
||||
|
|
|
@ -21,21 +21,16 @@
|
|||
|
||||
#include <blt/std/types.h>
|
||||
#include <blt/std/bump_allocator.h>
|
||||
#include <blt/std/assert.h>
|
||||
#include <blt/logging/logging.h>
|
||||
#include <blt/std/allocator.h>
|
||||
#include <blt/std/ranges.h>
|
||||
#include <blt/meta/meta.h>
|
||||
#include <blt/gp/fwdecl.h>
|
||||
#include <blt/gp/util/trackers.h>
|
||||
#include <blt/gp/util/meta.h>
|
||||
#include <blt/gp/allocator.h>
|
||||
#include <utility>
|
||||
#include <stdexcept>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
namespace blt::gp
|
||||
{
|
||||
|
@ -87,7 +82,7 @@ namespace blt::gp
|
|||
static constexpr size_t aligned_size() noexcept
|
||||
{
|
||||
const auto bytes = detail::aligned_size(sizeof(NO_REF_T<T>));
|
||||
if constexpr (blt::gp::detail::has_func_drop_v<T>)
|
||||
if constexpr (blt::gp::detail::has_func_drop_v<gp::detail::remove_cv_ref<T>>)
|
||||
return bytes + detail::aligned_size(sizeof(std::atomic_uint64_t*));
|
||||
return bytes;
|
||||
}
|
||||
|
@ -179,7 +174,7 @@ namespace blt::gp
|
|||
const auto ptr = static_cast<char*>(allocate_bytes_for_size(aligned_size<NO_REF>()));
|
||||
std::memcpy(ptr, &t, sizeof(NO_REF));
|
||||
|
||||
if constexpr (gp::detail::has_func_drop_v<T>)
|
||||
if constexpr (gp::detail::has_func_drop_v<gp::detail::remove_cv_ref<T>>)
|
||||
{
|
||||
new(ptr + sizeof(NO_REF)) mem::pointer_storage<std::atomic_uint64_t>{nullptr};
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace blt::gp
|
|||
|
||||
~evaluation_ref()
|
||||
{
|
||||
if constexpr (detail::has_func_drop_v<T>)
|
||||
if constexpr (detail::has_func_drop_v<detail::remove_cv_ref<T>>)
|
||||
{
|
||||
if (m_value.get() != nullptr)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace blt::gp
|
|||
template <typename T>
|
||||
static type make_type(const type_id id)
|
||||
{
|
||||
return type(stack_allocator::aligned_size<T>(), id, blt::type_string<T>(), detail::has_func_drop_v<T>);
|
||||
return type(stack_allocator::aligned_size<T>(), id, blt::type_string<T>(), detail::has_func_drop_v<detail::remove_cv_ref<T>>);
|
||||
}
|
||||
|
||||
[[nodiscard]] size_t size() const
|
||||
|
|
2
lib/blt
2
lib/blt
|
@ -1 +1 @@
|
|||
Subproject commit 284743c683aebae3277f64a07cdd0deedf629039
|
||||
Subproject commit 9a05c86b02c9c45c2b384c531007416148ec4b56
|
Loading…
Reference in New Issue