struct dtor never called, what's wrong?
schveiguy at yahoo.com
Fri Jun 15 15:49:01 UTC 2018
On 6/15/18 11:18 AM, Andrea Fontana wrote:
> On Friday, 15 June 2018 at 15:10:54 UTC, Steven Schveighoffer wrote:
>> I tried using -vcg-ast, and see an interesting lowering:
>> for (; !__r115.empty(); __r115.popFront())
>> ref A r = __r115.front();
> Also for std.array:array?
> I don't get where it is using foreach with refs.
> Can be this  the problem instead?
>  https://github.com/dlang/phobos/blob/master/std/array.d#L126
That is a separate bug. The array function appears not to set the
correct bits for the GC block. It should set the appendable bit, and the
finalize and struct finalize bits. All it sets is the no-scan bit. It
also needs to set up the allocated size properly. I think
uninitializedArray is a bad idea for array to use when the type being
inserted has a dtor.
So the code is executing all the proper postblits and destructors, it's
just that the GC is not executing the destructors.
Can you file a bug or search for one on this? I will see if I can fix it.
More information about the Digitalmars-d