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.
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