digitalmars.D.bugs - [Issue 6285] New: switch-case statement fails for enums of strings
- d-bugmail puremagic.com (39/39) Jul 10 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6285
- d-bugmail puremagic.com (12/12) Jul 10 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6285
http://d.puremagic.com/issues/show_bug.cgi?id=6285 Summary: switch-case statement fails for enums of strings Product: D Version: D2 Platform: x86_64 OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: blazej.podsiadlo gmail.com --- Comment #0 from Blazej Podsiadlo <blazej.podsiadlo gmail.com> 2011-07-10 13:59:13 PDT --- Hi, Switch-case statement fails for enums of strings because it is not of integral type. For the following code: enum strEnum : string {strA = "strA", strB = "strB"}; strEnum se = strEnum.strA; switch (strEnum) { case strEnum.strA: break; }; I get the error message: Error: 'strEnum' is not of integral type, it is a strEnum In the same moment, I can workaround that by: string realStr = strEnum.strA; switch (realStr) { case strEnum.strA: break; }; Unfortunately it doesn't help in my case where I want use final switch: final switch (strEnum) { case strEnum.strA: break; case strEnum.strB: break; }; Best Regards Blazej -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 10 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6285 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |kennytm gmail.com Resolution| |DUPLICATE --- Comment #1 from kennytm gmail.com 2011-07-10 14:18:36 PDT --- *** This issue has been marked as a duplicate of issue 2950 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 10 2011