www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16277] New: Can't use atomicStore with classes or interface

https://issues.dlang.org/show_bug.cgi?id=16277

          Issue ID: 16277
           Summary: Can't use atomicStore with classes or interface
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: aliloko gmail.com

Is this normal?

-------------------------------
interface IL
{

}

import core.atomic;

void main()
{
    IL i;
    shared(IL) j;    
    atomicStore(j, i);

}
-------------------------------

As of DMD 2.071, this gives an error:

/d391/f135.d(12): Error: template core.atomic.atomicStore cannot deduce
function from argument types !()(shared(IL), IL), candidates are:
/opt/compilers/dmd2/include/core/atomic.d(1100):
core.atomic.atomicStore(MemoryOrder ms = MemoryOrder.seq, T, V1)(ref shared T
val, V1 newval) if (__traits(compiles, () { val = newval; } ))


Is that constraint { val = newval; } valid?

I would have thought atomics would work with types who are just pointers, like
class instances and interfaces.

--
Jul 13 2016