bug in foreach continue

Hussien via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 16 18:55:19 PDT 2017


On Friday, 17 March 2017 at 01:41:47 UTC, Adam D. Ruppe wrote:
> On Friday, 17 March 2017 at 01:34:52 UTC, Hussien wrote:
>> Seems like continue needs to be static aware.
>
> That's not a bug, pragma is triggered when the code is 
> *compiled*, not when it is run. The code is compiled, even if 
> it is skipped over by a continue.

My point is, that it shouldnt! a static if should have a static 
continue in some way. It is confusing to be thinking in terms of 
the compile time code and (static if) and use a ambiguous 
statement(continue) and it not be compile time.

Either one needs a static version of continue or a warning when 
used inside a static if.

As is, continue doesn't even apply to the static case, so it 
shouldn't be allowed. A static foreach with a dynamic continue is 
illogical yet no warning is emitted.



More information about the Digitalmars-d-learn mailing list