[Issue 12026] New: One missing statement is not reachable error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 29 08:23:34 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12026

           Summary: One missing statement is not reachable error message
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2014-01-29 08:23:33 PST ---
dmd 2.065beta compiles this with no errors nor warnings:


void foo(ref int i) {
    if (i != 10 || i != 12)
        return;
    i++;
}
void main() {}



But I think that code should give (I consider this an enhancement request):

test.d(4): Warning: statement is not reachable


Because the (i != 10 || i != 12) condition is always true (also because foo is
not a template function).

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list