[Issue 10281] New: pure methods can use shared fields

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 6 04:23:06 PDT 2013


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 at puremagic.com
        ReportedBy: Marco.Leise at gmx.de


--- Comment #0 from Marco Leise <Marco.Leise at 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: -------


More information about the Digitalmars-d-bugs mailing list