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
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