[Issue 10113] New: Can't use an enum : string in a switch statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 17 23:39:10 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10113

           Summary: Can't use an enum : string in a switch statement
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tcdknutson at gmail.com


--- Comment #0 from Dylan <tcdknutson at gmail.com> 2013-05-17 23:39:09 PDT ---
Instances of an enum of type string can't be passed into a switch or final
switch:

----
enum Test : string {
    Foo = "Foo",
}

Test a = Test.Foo;
switch(a) {
    case Test.Foo: break;
}
----

even though a string is a valid type to pass into a (final) switch. 

Compiler error: 
Error: 'a' must be of integral or string type, it is a Test

but obviously the underlying type of 'a' is string.

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