digitalmars.D.bugs - [Issue 2792] New: Enum manifest constants and string produces errors
- d-bugmail puremagic.com (35/35) Apr 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2792
- d-bugmail puremagic.com (14/14) Apr 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2792
- d-bugmail puremagic.com (9/9) Apr 08 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2792
http://d.puremagic.com/issues/show_bug.cgi?id=2792 Summary: Enum manifest constants and string produces errors Product: D Version: 2.026 Platform: PC URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr oup=digitalmars.D&article_id=87067 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: gide nwawudu.com Using const, static const, auto, immutable instead of enum makes it work. Might be related to BUG 1884. import std.stdio; void main() { enum members = ["foo", "bar"]; for (uint i=0; i<members.length; i++) { writefln(members[i]); } } C:> dmd test.d C:> test object.Error: Access Violation std.encoding.EncodingSchemeASCII ðæB ANSI_X3.4-1968 ♫ ÆB ANSI_X3. 4-1986 ♫ ↑ÆB ASCII ♣ 0ÆB IBM367 ♠ ÆB ISO646-US PÆB I SO_646.irv:1991 ► hÆB US-ASCII êÆB cp367 ♣ áÆB csASCIIiso-i --
Apr 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2792 Another example. import std.stdio; void main() { enum members = ["foo", "bar"]; writefln(members[0]); // works fine writefln(members[1]); // works fine for (uint i=0; i<2; i++) { writefln(members[i]); // ERROR } } --
Apr 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2792 clugdbug yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE *** This bug has been marked as a duplicate of 2559 *** --
Apr 08 2009