[Issue 2423] Erroneous unreachable statement warning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 26 09:40:12 PDT 2008


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





------- Comment #1 from larsivar at igesund.net  2008-10-26 11:40 -------
There is also a related issue that will show in the same function if that has a
return value:

int foo() {
    do {
        return 1;
    } while  (true);
}

warning - whiletrue.d(4): Error: statement is not reachable
warning - whiletrue.d(1): function whiletrue.foo no return at end of function

I understand that the "no return" is a semantic challenge, but the rule is
fairly simple: if there is a while(true), then all code after it is dead code
unless there is also a break. This is also a regression.

Note that whereas the first is an obvious bug and impossible to workaround,
this one is possible to workaround, but still a question about quality of
implementation. The "no return" bug does also affect/break Tango when using
warnings.


-- 



More information about the Digitalmars-d-bugs mailing list