www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12026] New: One missing statement is not reachable error message

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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Jan 29 2014