Static foreach bug?
Basile B.
b2.temp at gmx.com
Sun Sep 2 15:27:30 UTC 2018
On Sunday, 2 September 2018 at 13:21:05 UTC, bauss wrote:
> Is there a reason why you cannot create a separate scope within
> a static foreach?
>
> The below will not compile:
>
> ```
> enum a = ["a" : "a", "b" : "b", "c" : "c"];
>
> static foreach (k,v; a)
> {
> {
> enum b = k;
> enum c = v;
> }
> }
> ```
>
> It works if it's in a function of course.
> [...]
At the global scope it cant work since there even block
statements are not possible, just this
```
{
enum b = 0;
enum c = 0;
}
```
doesn't compile; and this is what you tried to add in the `static
foreach` body. So if i understand correctly this is even not a
`static foreach` issue here.
More information about the Digitalmars-d
mailing list