Hi,
The following code calls __ArrayDtor
at the end of main
. However, since arr
is uninitialised, free(p)
produces a segmentation fault.
struct S
{
int *p;
~this()
{
free(p);
}
}
void main()
{
S[3] arr = void;
}
Is this the expected behaviour? One possible fix is to let the programmer handle the destruction of void-initialised arrays themselves.
I am asking because, in _d_arrayctor
, the throw
introduces call to __ArrayDtor
, which destroys the array to
. This call is unnecessary, as the _d_arrayctor
already destroys the initialised elements of to
, while the uninitialised ones need not be destroyed, as I said above.
Thanks,
Teodor