@@ -113,8 +113,11 @@ TailShared!T atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)(ref shared const T
113
113
* newval = The value to store.
114
114
*/
115
115
void atomicStore (MemoryOrder ms = MemoryOrder.seq, T, V)(ref T val, V newval) pure nothrow @nogc @trusted
116
- if (! is (T == shared S, S ) && ! is (V == shared U, U ))
116
+ if (! is (T == shared ) && ! is (V == shared ))
117
117
{
118
+ import core.internal.traits : hasElaborateCopyConstructor;
119
+ static assert (! hasElaborateCopyConstructor! T, " `T` may not have an elaborate copy: atomic operations override regular copying semantics." );
120
+
118
121
// resolve implicit conversions
119
122
T arg = newval;
120
123
@@ -163,7 +166,7 @@ void atomicStore(MemoryOrder ms = MemoryOrder.seq, T, V)(ref shared T val, share
163
166
* The value held previously by `val`.
164
167
*/
165
168
T atomicFetchAdd (MemoryOrder ms = MemoryOrder.seq, T)(ref T val, size_t mod) pure nothrow @nogc @trusted
166
- if ((__traits(isIntegral, T) || is (T == U* , U)) && ! is (T == shared V, V ))
169
+ if ((__traits(isIntegral, T) || is (T == U* , U)) && ! is (T == shared ))
167
170
in (atomicValueIsProperlyAligned(val))
168
171
{
169
172
static if (is (T == U* , U))
@@ -192,7 +195,7 @@ in (atomicValueIsProperlyAligned(val))
192
195
* The value held previously by `val`.
193
196
*/
194
197
T atomicFetchSub (MemoryOrder ms = MemoryOrder.seq, T)(ref T val, size_t mod) pure nothrow @nogc @trusted
195
- if ((__traits(isIntegral, T) || is (T == U* , U)) && ! is (T == shared U, U ))
198
+ if ((__traits(isIntegral, T) || is (T == U* , U)) && ! is (T == shared ))
196
199
in (atomicValueIsProperlyAligned(val))
197
200
{
198
201
static if (is (T == U* , U))
@@ -221,7 +224,7 @@ in (atomicValueIsProperlyAligned(val))
221
224
* The value held previously by `here`.
222
225
*/
223
226
T atomicExchange (MemoryOrder ms = MemoryOrder.seq,T,V)(T* here, V exchangeWith) pure nothrow @nogc @trusted
224
- if (! is (T == shared S, S ) && ! is (V == shared U, U ))
227
+ if (! is (T == shared ) && ! is (V == shared ))
225
228
in (atomicPtrIsProperlyAligned(here), " Argument `here` is not properly aligned" )
226
229
{
227
230
// resolve implicit conversions
@@ -242,7 +245,7 @@ TailShared!T atomicExchange(MemoryOrder ms = MemoryOrder.seq,T,V)(shared(T)* her
242
245
if (! is (T == class ))
243
246
in (atomicPtrIsProperlyAligned(here), " Argument `here` is not properly aligned" )
244
247
{
245
- static if (is (V == shared U, U ))
248
+ static if (is (V == shared ))
246
249
alias Thunk = U;
247
250
else
248
251
{
@@ -277,7 +280,7 @@ in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned")
277
280
* true if the store occurred, false if not.
278
281
*/
279
282
bool cas (MemoryOrder succ = MemoryOrder.seq,MemoryOrder fail = MemoryOrder.seq,T,V1 ,V2 )(T* here, V1 ifThis, V2 writeThis) pure nothrow @nogc @trusted
280
- if (! is (T == shared S, S ) && is (T : V1 ))
283
+ if (! is (T == shared ) && is (T : V1 ))
281
284
in (atomicPtrIsProperlyAligned(here), " Argument `here` is not properly aligned" )
282
285
{
283
286
// resolve implicit conversions
@@ -336,7 +339,7 @@ in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned")
336
339
* true if the store occurred, false if not.
337
340
*/
338
341
bool cas (MemoryOrder succ = MemoryOrder.seq,MemoryOrder fail = MemoryOrder.seq,T,V)(T* here, T* ifThis, V writeThis) pure nothrow @nogc @trusted
339
- if (! is (T == shared S, S ) && ! is (V == shared U, U ))
342
+ if (! is (T == shared ) && ! is (V == shared ))
340
343
in (atomicPtrIsProperlyAligned(here), " Argument `here` is not properly aligned" )
341
344
{
342
345
// resolve implicit conversions
@@ -401,7 +404,7 @@ in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned")
401
404
* true if the store occurred, false if not.
402
405
*/
403
406
bool casWeak (MemoryOrder succ = MemoryOrder.seq,MemoryOrder fail = MemoryOrder.seq,T,V1 ,V2 )(T* here, V1 ifThis, V2 writeThis) pure nothrow @nogc @trusted
404
- if (! is (T == shared S, S ) && is (T : V1 ))
407
+ if (! is (T == shared ) && is (T : V1 ))
405
408
in (atomicPtrIsProperlyAligned(here), " Argument `here` is not properly aligned" )
406
409
{
407
410
// resolve implicit conversions
0 commit comments