http://d.puremagic.com/issues/show_bug.cgi?id=6654
Summary: Fixed-sized array length not accessible in pure functions Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: minor Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 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. Workaround: int[3] foo; void main() pure { auto n = typeof(foo).length; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------