[Issue 8690] New: Can't access a global enum size_t from a pure function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 18 20:03:02 PDT 2012


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

           Summary: Can't access a global enum size_t from a pure function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-09-18 20:04:01 PDT ---
int[1] foo;
enum fooLength = 1;
void main() pure {
    auto n1 = fooLength; // OK
    auto n2 = foo.length; // error
}



DMD 2.061alpha shows:

test.d(5): Error: pure function 'D main' cannot access mutable static data
'foo'


But foo.length is a compile-time constant.

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