Summary: Pure contracts Unnecessarily strict
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD

--- Comment #0 from Era Scarecrow <> 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)
        assert(o >= 0, "Negative value! Check structure:" ~ to!string(size) ~
    body { ... } 

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to