Created attachment 78 [details] Smart pointer example Please consider the RAII smart pointer implementation attached. The smart pointer is implemented following the rule of three. The unit test, however, fails on line 137. When a static array is being initialized over with the array's init, GDC neither calls the destructors nor uses opAssign, causing a resource leak. This problem also exists in DMD, and was filed there (see https://issues.dlang.org/show_bug.cgi?id=13661). Changing the static if at line 108 to false, we reset the array by using array iteration to assign to the individual elements. This variant passes on DMD, but fails on GDC. Lastly, changing the static if at line 110 to false, we perform an actual loop over the elements. This passes on all compilers. To the best of my understanding: array type[4] a; the following three lines should be completely equivalent: a = a.init; a[] = type.init; foreach(ref i; a) i = type.init; Shachar
This would have been supported since 2.068 update. https://github.com/D-Programming-GDC/GDC/pull/162