[Issue 6060] New: Refuse wrong final switch

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 26 16:01:07 PDT 2011


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

           Summary: Refuse wrong final switch
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-05-26 15:56:47 PDT ---
This program compiles and runs with no errors:


void main(string[] args) {
    final switch (args.length) {
        case 0: break;
    }
}


But in such cases I suggest the compiler to statically refuse this code, and
give an error.

See also bug 5713 and bug 5714

Note this bug is different from 5713 because in 5713 I don't like an error
message (and I'd like the compiler to enforce the presence of the cases for
0,1, and 2), while in this case I'd like an error message.

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