Bug 14746 – [REG2.068a] Behavior change with struct destructor and alias this

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-06-29T06:06:00Z
Last change time
2017-07-19T17:41:49Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
briancschott

Comments

Comment #0 by briancschott — 2015-06-29T06:06:41Z
``` 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.
Comment #1 by k.hara.pg — 2015-06-30T04:11:07Z
Comment #2 by k.hara.pg — 2015-06-30T11:28:24Z
Comment #3 by github-bugzilla — 2015-07-01T09:10:19Z
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
Comment #4 by code — 2015-07-01T09:28:57Z
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.
Comment #5 by github-bugzilla — 2015-07-01T11:17:17Z
Comment #6 by github-bugzilla — 2015-07-07T13:04:53Z
Comment #7 by github-bugzilla — 2017-07-19T17:41:49Z
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