Consider:
import std.stdio;
struct S1 {
this(int) { writeln("constructed"); }
~this() { writeln("destroyed"); }
}
struct S2 { this(int) { throw new Exception("a"); } }
void fun(S1, S2, S1) {}
void main()
{
fun(S1(2), S2(2), S1(2));
}
Running this code will create an object of type S1 that is never destroyed. This is somewhat related to http://d.puremagic.com/issues/show_bug.cgi?id=9704, just there's no postblit.
Comment #1 by maxim — 2013-07-12T09:08:36Z
I think this can be marked as a dup because it is a particular situation of essentially the same case described in issue 9704.
Comment #2 by monarchdodra — 2013-07-12T11:05:06Z
(In reply to comment #1)
> I think this can be marked as a dup because it is a particular situation of
> essentially the same case described in issue 9704.
This indeed a more generically worded description, but essentially, the same thing.
Also, (since links never hurt), this issue was also discussed recently in learn:
http://forum.dlang.org/thread/20130628005448.00000969@unknown?page=2
*** This issue has been marked as a duplicate of issue 9704 ***