[Issue 2423] New: Erroneous unreachable statement warning

Don nospam at nospam.com.au
Mon Oct 20 01:00:40 PDT 2008


d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=2423
> 
>            Summary: Erroneous unreachable statement warning
>            Product: D
>            Version: 1.035
>           Platform: Other
>         OS/Version: All
>             Status: NEW
>           Keywords: diagnostic
>           Severity: regression
>           Priority: P2
>          Component: DMD
>         AssignedTo: bugzilla at digitalmars.com
>         ReportedBy: larsivar at igesund.net
> 
> 
> 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.
> 
> 
Why is that wrong? "return 1" looks unreachable to me.


More information about the Digitalmars-d-bugs mailing list