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

           Summary: Static fixed size array of enums initialization fails
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: tommitiss...@hotmail.com


--- Comment #0 from Tommi <tommitiss...@hotmail.com> 2012-07-09 14:49:44 PDT ---
module main;

immutable(int[2]) ints =
{
    int[2] tempInts; // #0: OK
    for (int i = 0; i < 2; ++i)
    {
        tempInts[i] = i;
    }
    return cast(immutable) tempInts;
}(); // #1: OK

enum MyEnum { first, second, third, fourth }

immutable(MyEnum[2]) enums =
{
    MyEnum[2] tempEnums; // #2
    for (int i = 0; i < 2; ++i)
    {
        tempEnums[i] = cast(MyEnum) i;
    }
    return cast(immutable) tempEnums;
}(); // #3

void main(string[] args)
{
}

// #2: Error: Array length mismatch assigning [0..0] to [0..2]
// #3: Error: called from here: (*delegate pure nothrow @safe
immutable(MyEnum[2u])()

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

Reply via email to