static if enhancement

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 24 10:54:21 PDT 2016


On 6/24/16 1:15 PM, Steven Schveighoffer wrote:
> The problem that hasn't been made clear is, why can't you just write:
>
> static if(condition)
> {
>     ... // some code
>     return;
> }
>
> // some more code
>
> And the answer is, I'm guessing, bug 14835 -- misguided "unreachable
> statement" warnings.
>
> Should we mark your bug as a duplicate?

Sorry, the problem is that the code doesn't compile at all if the static 
if is false. So I need to insert the "else".

The compiler should not attempt at all to compile the code after the 
static if.


Andrei



More information about the Digitalmars-d mailing list