Static foreach pull request

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Tue May 9 14:56:11 PDT 2017


On 09.05.2017 23:39, Guillaume Boucher wrote:
> On Tuesday, 9 May 2017 at 03:06:37 UTC, Timon Gehr wrote:
>> If you are interested in static foreach making it into the language,
>> please play with the implementation and tell me how to break it.
>
> Code:
>
> void main() {
>     void f() { idonotexist(); }
>     static foreach(j;0..0) {
>         f();
>     }
> }
>
>
> Output:
>
> test_staticforeach.d(3): Error: undefined identifier 'idonotexist'
> Statement::blockExit(0x7f38d5cd35e0)
> static foreach (j; __error)
> {
> f();
> }
>
> core.exception.AssertError at ddmd/blockexit.d(90): Assertion failure
> ----------------
> ...

Thanks! (It's a known issue though: 
https://github.com/tgehr/dmd/blob/static-foreach/test_staticforeach.d#L330.)

I guess the problem is that I do not propagate the error condition 
properly, but I'm not sure how to do it. (In my frontend, error handling 
control flow is automated almost completely.)


More information about the Digitalmars-d mailing list