www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2792] New: Enum manifest constants and string produces errors

reply d-bugmail puremagic.com writes:
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
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2792





------- Comment #1 from gide nwawudu.com  2009-04-03 14:23 -------
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
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2792


clugdbug yahoo.com.au changed:

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




------- Comment #2 from clugdbug yahoo.com.au  2009-04-08 02:09 -------


*** This bug has been marked as a duplicate of 2559 ***


-- 
Apr 08 2009