www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14746] New: Behavior change with struct destructor and alias

https://issues.dlang.org/show_bug.cgi?id=14746

          Issue ID: 14746
           Summary: Behavior change with struct destructor and alias this
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: briancschott gmail.com

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

--
Jun 28 2015