www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2950] New: Switch for enum : string fails

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2950

           Summary: Switch for enum : string fails
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: temiy aisys.ru


enum TestEnum : string { f = "first", s = "second", t = "third" }

void main ()
{
        TestEnum en = TestEnum.s;
        switch (en)
        {
        case TestEnum.f:
                break;
        case TestEnum.s:
                break;
        case TestEnum.t:
                break;
        }
}

enumBug.d(10): Error: Integer constant expression expected instead of "first"
enumBug.d(12): Error: Integer constant expression expected instead of "second"
enumBug.d(14): Error: Integer constant expression expected instead of "third"


-- 
May 07 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2950


Tomasz Sowiński <tomeksowi gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ingenu libertysurf.fr


--- Comment #1 from Tomasz Sowiński <tomeksowi gmail.com> 2010-10-22 14:02:22
PDT ---
*** Issue 4670 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 22 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2950


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blazej.podsiadlo gmail.com


--- Comment #2 from kennytm gmail.com 2011-07-10 14:18:36 PDT ---
*** Issue 6285 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2950



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-10-26
16:20:10 PDT ---
Created an attachment (id=1157)
Partial patch

Partial patch against commit 6c01188d71433508bc4c0af6b821a97e8df2e986

The problem is this won't compile with -g option.
When `EnumDeclaration::toDebug` is called, it calls cv4_Denum, which expects
the enum to have an integer base type. It tries to call `toInteger` method on
the enum declaration.

`cv4_Denum` is a complicated function, I don't know how to implement a fix
there.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2950


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-12-08
09:22:38 PST ---
http://d.puremagic.com/issues/show_bug.cgi?id=2950

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2950



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-04
18:18:02 PST ---
(In reply to comment #4)
 http://d.puremagic.com/issues/show_bug.cgi?id=2950
Should have been: https://github.com/D-Programming-Language/dmd/pull/1358 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 04 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2950


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

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


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-09
19:20:38 PDT ---
*** This issue has been marked as a duplicate of issue 10113 ***

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