[Issue 18050] New: Destructor called without corresponding postblit

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 9 06:11:22 UTC 2017


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

          Issue ID: 18050
           Summary: Destructor called without corresponding postblit
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: slavo5150 at yahoo.com

import std.stdio;

struct Foo {
    this(int) {}
    ~this() {}
}

struct Bar {
    this(this) {
        writefln("Bar.this(this): %X", &this);
    }
    this(Foo, Foo) {
        writefln("Bar.this(int): %X", &this);
    }
    ~this() {
        writefln("Bar.~this(): %X", &this);
    }
}

void fun(Bar n) {
    writefln("fun: %X", &n);
}

void main() {
    fun(Bar(Foo(0), Foo(1)));
}

Bar.this(int): 7FFD0B307D21
fun: 7FFD0B307CD0
Bar.~this(): 7FFD0B307CD0
Bar.~this(): 7FFD0B307D21

https://run.dlang.io/is/ivulRI

See http://forum.dlang.org/post/os5k0m$10p4$1@digitalmars.com

--


More information about the Digitalmars-d-bugs mailing list