just checked this with gdc and dmd head. interesting that a = a.init;
works the same in gdc and in dmd: just calls destructors for structs. but doing a[] = S.init works different. gdc does the same as in the first case: just calling destructors for all array elements. but dmd head calls postblits before destructing for all array elements (and then calls destructors for this copied elements). i.e. first case: destructor: bff51e2b destructor: bff51e2a destructor: bff51e29 destructor: bff51e28 second case: postblit: bff9405c destructor: bff94028 postblit: bff9405d destructor: bff94028 postblit: bff9405e destructor: bff94028 postblit: bff9405f destructor: bff94028 destructor: bff9405f destructor: bff9405e destructor: bff9405d destructor: bff9405c besides, dmd calls destructor for the first array element four times (bff94028). i think that this is definitely compiler bug. if dmd insists on postbliting, it should at least call destructors for all array elements, not only for the first one four times. ;-)
signature.asc
Description: PGP signature