Bug 13463 – Post-blit constructor not called for "out" contract when returning struct
Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-09-12T12:15:00Z
Last change time
2015-07-01T07:40:08Z
Keywords
contracts, wrong-code
Assigned to
nobody
Creator
dlang-bugzilla
Comments
Comment #0 by dlang-bugzilla — 2014-09-12T12:15:12Z
/////////// 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