[Issue 10623] New: destructor not called for function argument if constructing another argument throws
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 12 08:52:51 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10623
Summary: destructor not called for function argument if
constructing another argument throws
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrei at erdani.com
--- Comment #0 from Andrei Alexandrescu <andrei at erdani.com> 2013-07-12 08:52:50 PDT ---
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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list