[Issue 9256] New: A purity-related error message in case of member access

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 1 20:55:16 PST 2013


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

           Summary: A purity-related error message in case of member
                    access
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-01-01 20:55:15 PST ---
struct Foo {
    int x;
}
void main() pure {
    int y = Foo.x;
}


With DMD 2.061 gives this error message:

test.d(5): Error: pure nested function 'main' cannot access mutable data 'x'


But I think a better error message should be something like:

test.d(5): Error: need 'this' to access member x

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