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

--- Comment #2 from ag0aep6g <[email protected]> ---
(In reply to ag0aep6g from comment #1)
> (In reply to Jacob Carlborg from comment #0)
[...]
> > Foo newFoo() pure
> > {
> >     return Foo(null);
> > }
[...]
> 
> This is ok, because newFoo [...] immediately returns the
> constructed Foo.

Correction: That doesn't matter. newFoo returns a mutable Foo, so it could
create the Foo, modify the data, and only then return the Foo. The important
bit is that the data is guaranteed to be newly created inside newFoo. It can't
come from a global or parameter. Any mutable references cease to exist when
newFoo returns.

--

Reply via email to