[Issue 8365] New: Static fixed size array of enums initialization fails
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 9 14:49:45 PDT 2012
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: nobody at puremagic.com
ReportedBy: tommitissari at hotmail.com
--- Comment #0 from Tommi <tommitissari at 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: -------
More information about the Digitalmars-d-bugs
mailing list