https://issues.dlang.org/show_bug.cgi?id=24754
Nick Treleaven <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #3 from Nick Treleaven <[email protected]> --- > This might be a bug, DIP1000 should be catching this I think. If `&e` is the address of an int inside the `Foo.foo` array, then that is fine so long as the array is null or GC allocated. However, if Foo.foo is changed to `int[1] foo;`, it still won't error and it should: ```d import std.stdio; struct Foo { int[1] foo; @safe int* foobar() { int* f; foreach(ref e; foo) f = &e; // escaping address of foo[0] return f; } } void main() @safe { int* p; { Foo foo = Foo([1]); //writeln(&foo.foo[0]); p = foo.foobar(); } p.writeln(); (*p).writeln(); } ``` --
