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

           Summary: Static initializers for fixed size arrays too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-07-22 06:22:17 PDT ---
struct Foo { int[15] x; string s; }
void main() {
    Foo[5] a1 = Foo([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "hello"); // OK
    Foo f = { s: "hello" }; // OK (not static)
    Foo[5] a2 = { s: "hello" }; // error
}


DMD 2.060alpha gives:

temp.d(5): Error: a struct is not a valid initializer for a Foo[5u]
temp.d(5): Error: variable temp.main.a2 is not a static and cannot have static
initializer


I'd like the third syntax too to work, because it saves me to specify all the
struct fields, like the x array.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to