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

           Summary: Pure contracts Unnecessarily strict
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: rtcv...@yahoo.com


--- Comment #0 from Era Scarecrow <rtcv...@yahoo.com> 2012-01-30 14:23:53 PST 
---
The compiler complaining to me that my function isn't 'pure' by calling a
non-pure function, specifically to!string(). 

However the unpure functions used are only accessed in the contracts (and only
if it failed). The contracts shouldn't be considered as part of the pure
contract. This is because they are totally excluded during the release builds
(and shouldn't have any side effects anyways).



Error: pure function 'offset' cannot call impure function 'to'  


struct X
{
    int size;

...

    const pure int offset(int field)
    out(o)
    {
        assert(o >= 0, "Negative value! Check structure:" ~ to!string(size) ~
"\n");
    }
    body { ... } 
}

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

Reply via email to