[Issue 4517] New: final switch over with base type allows missing values

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 27 00:37:47 PDT 2010


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

           Summary: final switch over with base type allows missing values
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: braddr at puremagic.com


--- Comment #0 from Brad Roberts <braddr at puremagic.com> 2010-07-27 00:37:46 PDT ---
module finalswitch;

enum foo : ushort
{
    A = 1,
    B = 3
}

void bar(foo f)
{
    final switch(f)
    {
        case foo.A:
            break;
    }
}

This compiles without error:
$ dmd -c finalswitch.d 
$

Dropping the ': ushort' part and it correctly identifies the missing case:
$ dmd -c finalswitch.d 
finalswitch.d(11): Error: enum member B not represented in final switch

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