Thread overview
[Issue 8410] New: Static initializers for fixed size arrays too
Jul 24, 2012
Kenji Hara
July 22, 2012
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: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
July 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8410


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-23 21:40:32 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1063

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8410



--- Comment #2 from github-bugzilla@puremagic.com 2012-08-24 06:06:40 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/28d78922f17ce2380340770488338da1fe9cad0c fix Issue 8410 - Static initializers for fixed size arrays too

https://github.com/D-Programming-Language/dmd/commit/0ef718025a42f6912ff9acc15ad7ba7a5f1b554c Merge pull request #1063 from 9rnsr/fix8410

Issue 8410 - Static initializers for fixed size arrays too

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8410


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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