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

--- Comment #0 from 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

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:
------- You are receiving this mail because: -------

Reply via email to