www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9600] New: Inner class is not finalized on parent class finalization

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9600

           Summary: Inner class is not finalized on parent class
                    finalization
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-02-27
12:40:35 MSK ---
---
extern (C) void rt_finalize2(void* p, bool det = true, bool resetMemory =
true);

class A
{
    class B
    {
        int n;
        ~this() { n = 7; }
    }
}

void main()
{
    A a = new A;
    A.B b = a.new B;
    rt_finalize2(cast(void*) a);
    assert(b.n == 7); // fails
}
---

I see no reasons for such "orphan" class to be "alive" as we even doesn't have
"isFinalized" function for object checking to be finalized.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9600



--- Comment #1 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-02-27
12:43:31 MSK ---
Damn, `n` in example must not be a field. Is should be a global TLS variable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2013