[Issue 8923] New: Destructors of struct members get called at the wrong point
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 31 10:55:38 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8923
Summary: Destructors of struct members get called at the wrong
point
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: malteskarupke at web.de
--- Comment #0 from Malte Skarupke <malteskarupke at web.de> 2012-10-31 10:55:37 PDT ---
The destructor of the member of a struct doesn't get called when I expect it to
be called. I'd expect it to be called at the end of the destructor of the
containing struct. I'm not sure when it gets called instead, but it is too
late. Here is a case that segfaults in DMD 2.060:
void main()
{
bool destructorCalled = false;
struct DestructorCounter
{
~this()
{
destructorCalled = true; // segmentation fault
}
}
struct S
{
DestructorCounter a;
}
S s;
}
If this is supposed to be invalid I can provide examples that are most
definitely not supposed to be invalid, but are a bit more lengthy.
--
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