Summary: Fixed-sized array length not accessible in pure
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-09-12 13:18:31 PDT ---
Severity is 'minor' because there is a simple workaround.

D2 code:

int[3] foo;
void main() pure {
    auto n = foo.length;

DMD 2.055 gives:
test.d(3): Error: pure function 'main' cannot access mutable static data 'foo'

But I think this code is correct because foo.length is a compile-time constant,
so it doesn't break the purity of the main.


int[3] foo;
void main() pure {
    auto n = typeof(foo).length;

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

Reply via email to