Summary: Can't use 'this' pointer in pure member function?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Dmitry Olshansky <> 2012-07-26 
13:53:25 PDT ---
A test case, probably can be reduced futher:

@trusted public struct RleBitSet(T)
    @property auto byInterval() pure const
        static struct IntervalRange
            this(in RleBitSet set_)

        return IntervalRange(this);


immutable set = RleBitSet!(uint).init;

pure void func()
    auto x = set.byInterval;    

Tested on DMD 2.060 beta. Compiler flags seem to have no effect.

bug.d(14): Error: pure function 'byInterval' cannot call impure function 'this'

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

Reply via email to