[Issue 9006] New: Static struct with nested struct fields sometimes has current context pointers in `init`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 12 05:18:11 PST 2012


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

           Summary: Static struct with nested struct fields sometimes has
                    current context pointers in `init`
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-11-12 16:18:07 MSK ---
---
void main()
{
    int i;
    struct NS
    {
        int n;
      //int[3] a; // Uncomment to fail assert on line 20 and pass on line 23
        int f() { return i; }
    }
    NS ns;
    assert(ns != NS.init);
    ns = NS.init;
    assert(ns == NS.init);

    static struct SS { NS ns; }
    assert(SS.init.ns == NS.init); // fails
    assert(SS.init.ns != NS());    // fails

    SS s;
    assert(s.ns != NS.init); // line 20
    assert(s != SS.init);    // fails
    s = SS.init;
    assert(s.ns == NS.init); // line 23, fails
    assert(s == SS.init);
}
---

May be related to/duplicate of Bug 9003.

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