[Issue 24754] cannot take address of a member array in a ref foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 13 12:41:15 UTC 2024


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

--- Comment #14 from Dennis <dkorpel at live.nl> ---
(In reply to Nick Treleaven from comment #12)
> The compiler doesn't know (without optimization or -dip1000) that the
> program is equivalent to that. 

It could, all it needs to know is that typeof(Foo.foo) == typeof(new int[1]) ==
int[].

> It doesn't know below that `f` doesn't escape
> the scope of foobar somehow.

Doesn't mattter, `f` may escape, unless it's a `scope int[]`, which doesn't
really exist without `-preview=dip1000`.

--


More information about the Digitalmars-d-bugs mailing list