[Issue 1171] New: Cannot create a static array with the length of a const static array in function scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 20 11:26:55 PDT 2007


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

           Summary: Cannot create a static array with the length of a const
                    static array in function scope
           Product: D
           Version: 1.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: deewiant at gmail.com


(Set version to 1.012: there's no 1.013 yet.)

void main() {
        const int[2] foo;
        int[foo.length] bar;
}

Compiling the above results in the error "Error: no property 'length' for type
'int'". No module or line information, hence the "diagnostic" keyword on this
bug.

Move the code outside of function scope and/or remove the const from "foo" and
the code compiles.

Also, replacing foo.length with mixin("foo.length") works, which is odd.


-- 



More information about the Digitalmars-d-bugs mailing list