[Issue 6285] New: switch-case statement fails for enums of strings
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 10 14:04:21 PDT 2011
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 at puremagic.com
ReportedBy: blazej.podsiadlo at gmail.com
--- Comment #0 from Blazej Podsiadlo <blazej.podsiadlo at 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: -------
More information about the Digitalmars-d-bugs
mailing list