From 437501c22129067f6cb4e0ff619b82d62da4aed5 Mon Sep 17 00:00:00 2001 From: LunaTheFoxgirl Date: Tue, 9 Apr 2024 20:54:16 +0200 Subject: [PATCH] Fix LDC2 builds for unique_ptr moves. --- source/numem/mem/ptr.d | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/source/numem/mem/ptr.d b/source/numem/mem/ptr.d index c8b9f16..b85ecbf 100644 --- a/source/numem/mem/ptr.d +++ b/source/numem/mem/ptr.d @@ -175,7 +175,9 @@ public: // atomically moves the reference from this unique_ptr to the other unique_ptr reference // after this is done, rc is set to null to make this unique_ptr invalid. atomicStore(this.rc, cast(refcountmg_t!(T)*)other.rc); - atomicStore(other.rc, null); + + // For LDC2 we'll need to do some more cursed pointer casts to be able to call clear on a const. + (cast(unique_ptr!(T)*)&other).clear(); } // Destructor @@ -219,16 +221,6 @@ public: return rc ? cast(VT)rc.ref_ : null; } - /** - Gets the value of the unique pointer - - Returns null if the item is no longer valid. - */ - @trusted - VT opCast() { - return rc ? cast(VT)rc.ref_ : null; - } - /** Makes a weak borrow of the unique pointer, weak borrows do not affect whether the object can be deleted by ref count reaching 0.