[Bug 70] New: dtor / destructor not called for (rvalue) struct used in opApply
gdc-bugzilla at gdcproject.org
gdc-bugzilla at gdcproject.org
Mon Jul 8 02:59:05 PDT 2013
http://bugzilla.gdcproject.org/show_bug.cgi?id=70
Bug #: 70
Summary: dtor / destructor not called for (rvalue) struct used
in opApply
Classification: Unclassified
Product: GDC
Version: development
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: Normal
Component: gdc
AssignedTo: ibuclaw at gdcproject.org
ReportedBy: Marco.Leise at gmx.de
This code:
--- 8< ---------------
import core.stdc.stdio;
struct DestroyMe
{
~this() { printf("~this() called\n"); }
int opApply(in int delegate(int item) dg)
{
throw new Exception("Here we go!");
}
}
void main()
{
printf("Version with no dtor call:\n");
try {
foreach (item; DestroyMe()) {}
} catch {}
printf("Version with dtor call:\n");
try {
auto lvalue = DestroyMe();
foreach (item; lvalue) {}
} catch {}
}
--- >8 --------------
prints:
Version with no dtor call:
Version with dtor call:
~this() called
The bug is reproducable with GDC and LDC.
--
Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the D.gnu
mailing list