[Issue 23676] Static foreach hangs compilation for some time

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 14 17:40:46 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23676

--- Comment #6 from Bradley Chatha <bradley at chatha.dev> ---
Yeah, it does appear to be exponential. If you change the static foreach to
include a loop index; and then guard its body under a `static if(i < 1)`, the
slowdown appears to start at i < 8.

So in other words, my code is bad and I should feel bad ;)
(or more seriously it could be a combination of bad code and a bad pathway in
the frontend).

Curiously, `i < 1` allows the function to compile perfectly fine however `i <
2` makes you run into the `@safe function can't call @system function` error.
Is that a seperate attribute inference bug or am I missing something, because
you can easily add @safe onto the nested function to solve that problem.

--


More information about the Digitalmars-d-bugs mailing list