Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/core/atomic.d
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ template cas(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.
in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned")
{
// resolve implicit conversions
T arg1 = ifThis;
const T arg1 = ifThis;
T arg2 = writeThis;

static if (__traits(isFloating, T))
Expand Down Expand Up @@ -1276,4 +1276,13 @@ version (CoreUnittest)
shared NoIndirections n;
static assert(is(typeof(atomicLoad(n)) == NoIndirections));
}

unittest // Issue 21631
{
shared uint si1 = 45;
shared uint si2 = 38;
shared uint* psi = &si1;

assert((&psi).cas(cast(const) psi, &si2));
}
}