[Issue 4291] New: Pure functions cannot access mixed in variables

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 7 02:40:16 PDT 2010


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

           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
        AssignedTo: nobody at puremagic.com
        ReportedBy: rsinfu at gmail.com


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

--------------------
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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list