digitalmars.D.bugs - [Issue 13463] New: Post-blit constructor not called for "out"
- via Digitalmars-d-bugs (45/45) Sep 12 2014 https://issues.dlang.org/show_bug.cgi?id=13463
https://issues.dlang.org/show_bug.cgi?id=13463 Issue ID: 13463 Summary: Post-blit constructor not called for "out" contract when returning struct Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: contracts, wrong-code Severity: major Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: thecybershadow gmail.com /////////// test.d ////////// import std.stdio; struct S { this(this) { writeln("Copied"); } ~this() { writeln("Destroyed"); } S fun() out(result) { } body { return this; } } void main() { S s; s.fun(); } ///////////////////////////// This prints: Destroyed Destroyed It should print (and does so when commenting out the contract): Copied Destroyed Destroyed --
Sep 12 2014