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

--- Comment #9 from Luís Ferreira <[email protected]> ---
(In reply to Dennis from comment #8)
> Reduces to:
> 
> ```D
> void main() @safe
> {
>     foreach(ref e; new int[1])
>         int* f = &e;
> }
> ```

Thanks! So, maybe this should also be valid, but more arguable if requires
dip1000 internal checks the same way with `ref`, although, spec-wise it should:

```
void main() @safe
{
    foreach(e; new int[1])
        int* f = &e;
}
```

I removed the `ref`, `f` doesn't escape its own scope, the same way this should
compile:

```
void main() @safe
{
    int e;
    int* f = &e;
}
```

--

Reply via email to