Memory leak in foreach

Andrea Fontana nospam at example.org
Wed Feb 20 16:19:08 UTC 2019


On Wednesday, 20 February 2019 at 16:16:27 UTC, Andrea Fontana 
wrote:
> On Wednesday, 20 February 2019 at 15:52:06 UTC, H. S. Teoh 
> wrote:
>> It's a different question of whether it should be a compile 
>> error to use `foreach(ref)` on a range whose .front doesn't 
>> return by ref.  That's a much more sticky issue that you may 
>> not want to get into. :-D  Fix the dtor bug first, then we can 
>> decide whether we want to pursue this question.
>
> Eh, you summed up my idea perfectly.
> Isn't exactly what my pull request is doing?
>
> Andrea

(My pr ignores ref for that case so dtor is called and memory 
freed)


More information about the Digitalmars-d mailing list