[Issue 8923] Destructors of struct members get called at the wrong point
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 31 11:54:38 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8923
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2012-10-31 11:54:36 PDT ---
In Windows, s1's dtor causes Access Violation, but s2's dtor runs successfully.
import core.stdc.stdio : printf;
void main()
{
bool destructorCalled = false;
struct DestructorCounter
{
~this()
{
printf("-dtor\n");
destructorCalled = true; // segmentation fault
}
}
struct S
{
DestructorCounter a;
}
S s1; // Access Violation
S s2 = S(); // OK
}
Output:
---
-dtor (s2's dtor call)
-dtor (s1's dtor call)
object.Error: Access Violation
---
I think this is definitely a wrong-code bug.
--
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