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





------- Comment #3 from [EMAIL PROTECTED]  2008-10-26 12:52 -------
(In reply to comment #0)
> Consider the following function:
> 
> void foo() {
> 
>     do {
>         if (false)
>             return 1;
>     } while (true);
> }
> 
> Compiling with -w, results in
> 
> warning - whiletrue.d(6): Error: statement is not reachable
> 
> Minimized from a module in Tango, meaning Tango does not compile with warnings
> on.
> 
> This regression was introduced in DMD 1.032.
> 

Erm, actually, I wonder if this is even valid.  do-while loops in D do not
require a semicolon at the end.  The "unreachable statement" is simply the
empty statement that follows the "while(true)".  The following code:

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

gives no warnings.


-- 

Reply via email to