[Issue 6293] New: [Regression 2.054] 'pure' does not work with member of array of aggregrate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 12 01:43:54 PDT 2011


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

           Summary: [Regression 2.054] 'pure' does not work with member of
                    array of aggregrate
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-07-12 01:38:45 PDT ---
Test case
-----------------------
class C6293 {
    int token;
}
struct S6293 {
    const(C6293)[] tokens;
    void f() const pure {
        const(C6293) a = tokens[0];
        int b = a.token;           // <-- separating it is ok.
        int c = tokens[0].token;   // <-- cannot access mutable data 'token'
    }
}
-----------------------
x.d(9): Error: pure nested function 'f' cannot access mutable data 'token'
-----------------------

If that 'b' can be accessed in a 'pure' function, there's no reason 'c' cannot.

-- 
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