[Issue 8923] Nested structs have null context pointers in static array variables and struct fields

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 8 07:30:24 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8923


Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg at gmail.com
            Summary|Destructors of struct       |Nested structs have null
                   |members get called at the   |context pointers in static
                   |wrong point                 |array variables and struct
                   |                            |fields


--- Comment #6 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-11-08 18:30:23 MSK ---
As commits are already pushed referencing this one, renaming the issue and
providing a comprehensive example (instead of creating a new one one marking
this as a duplicate):
---
void main()
{
    int i;
    struct CS { void f() { ++i; } }
    struct S { CS cs; }

    CS cs;
    assert(cs.tupleof[$-1] != null); // ok

    CS[1] csArr;
    assert(csArr[0].tupleof[$-1] != null); // fails

    S s1 = S();
    assert(s1.cs.tupleof[$-1] != null); // ok

    S s2;
    assert(s2.cs.tupleof[$-1] != null); // fails
}
---

-- 
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