Summary: Pure functions cannot access mixed in variables
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Shin Fujishiro <> 2010-06-07 02:40:13 PDT 
DMD raises a compiler error when a mixed in variable is used in a pure

void test() pure
    mixin declareVariable;
    var = 42; // Error: pure nested function 'test' cannot access
              //        mutable data 'var'
template declareVariable() { int var; }

The mixed-in variable var should be treated as if it's directly declared in
test()'s scope.  So the above code should be correct and accepted.

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

Reply via email to