``` import std.stdio; void main() { Ownership o; destroy(o); } struct HasADestructor { ~this() {writeln("test");} } struct Ownership { HasADestructor* pointer; alias pointer this; } ``` With 2.067.1 this program runs with no output. With 2.068.0-b1 it outputs the string "test". With both compiler versions simply letting the struct go out of scope does not result in any output.
Introduced in: https://github.com/D-Programming-Language/druntime/pull/1181
https://github.com/D-Programming-Language/druntime/pull/1310
Commits pushed to stable at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/1a2290b1c36f8cdf66a9c4ce388b6a4b38ff9735 fix Issue 14746 - Behavior change with struct destructor and alias this https://github.com/D-Programming-Language/druntime/commit/2f087248923ad77014259a52695f3abda076c206 Merge pull request #1312 from 9rnsr/fix14746 [REG2.068a] Issue 14746 - Behavior change with struct destructor and alias this
Same issue applies to postblitRecurse (which is used in std.conv). We also wanted to replace the recursive templates with the new compiler generated xdtor and xpostblit. https://github.com/D-Programming-Language/druntime/pull/1313 I think a similar issue plagues all the hasElaborateX templates.
Commits pushed to stable at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/c8518f5b62ae501ea740bc1b1996230c9927c70f fix Issue 14746 for postblitRecurse as well https://github.com/D-Programming-Language/druntime/commit/e0f2ca65b719fcc94dbd484bb9a8a0fe219ef806 Merge pull request #1313 from MartinNowak/fix14746 fixup Issue 14746
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/1a2290b1c36f8cdf66a9c4ce388b6a4b38ff9735 fix Issue 14746 - Behavior change with struct destructor and alias this https://github.com/D-Programming-Language/druntime/commit/2f087248923ad77014259a52695f3abda076c206 Merge pull request #1312 from 9rnsr/fix14746 https://github.com/D-Programming-Language/druntime/commit/c8518f5b62ae501ea740bc1b1996230c9927c70f fix Issue 14746 for postblitRecurse as well https://github.com/D-Programming-Language/druntime/commit/e0f2ca65b719fcc94dbd484bb9a8a0fe219ef806 Merge pull request #1313 from MartinNowak/fix14746
Commits pushed to dmd-cxx at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/1a2290b1c36f8cdf66a9c4ce388b6a4b38ff9735 fix Issue 14746 - Behavior change with struct destructor and alias this https://github.com/dlang/druntime/commit/2f087248923ad77014259a52695f3abda076c206 Merge pull request #1312 from 9rnsr/fix14746 https://github.com/dlang/druntime/commit/c8518f5b62ae501ea740bc1b1996230c9927c70f fix Issue 14746 for postblitRecurse as well https://github.com/dlang/druntime/commit/e0f2ca65b719fcc94dbd484bb9a8a0fe219ef806 Merge pull request #1313 from MartinNowak/fix14746