www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10281] New: pure methods can use shared fields

http://d.puremagic.com/issues/show_bug.cgi?id=10281

           Summary: pure methods can use shared fields
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: Marco.Leise gmx.de


--- Comment #0 from Marco Leise <Marco.Leise gmx.de> 2013-06-06 04:23:00 PDT ---
Pure doesn't consider shared variables accessed by other threads.
In this sense m_fill is like a global variable even though local to the
circular buffer struct and the implicit this parameter.


struct SCircularBuffer
{
    shared ℕ m_fill = 0;

     property ℕ availableBytesForReading() const pure nothrow
    {
        return atomicLoad(m_fill);
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 06 2013