www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9003] New: Nested structs smetimes have null context pointers in static struct

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

           Summary: Nested structs smetimes have null context pointers in
                    static struct
           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



15:59:31 MSK ---
Currently it's allowed to have nested struct fields in static struct (or global
templated structs):
---
void main() {
    int i;
    struct NS {
        int n;     // Comment to pass all asserts
     // int n2;    // Uncomment to fail assert on line 19
        int f() { return i; }
    }

    static struct SS1 {
        NS ns;
    }
    SS1 ss1;
    assert(ss1.ns != NS.init);

    static struct SS2 {
        NS ns1, ns2;
    }
    SS2 ss2;
    assert(ss2.ns1 != NS.init); // line 19
    assert(ss2.ns2 != NS.init);

    static struct SS3 {
        int i;
        NS ns;
    }

    SS3 ss3;
    assert(ss3.ns != NS.init);

    static struct SS4 {
        int i;
        NS ns1, ns2;
    }

    SS4 ss4;
    assert(ss4.ns1 != NS.init); // fails
    assert(ss4.ns2 != NS.init); // fails
}
---

Exactly same behavior for global templated structs like
`struct SS1(T) { T ns; }`.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9003


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/1282

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 13 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9003




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/450aeed65f9b9f16186f83eee289dbd885051186
fix Issue 9003 - Nested structs smetimes have null context pointers in static
struct

https://github.com/D-Programming-Language/dmd/commit/0f91ce38927fc354afe7624bb5f93eb7078d8f49


Issue 9003 & 9006 - fill nested struct context pointers

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 13 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9003


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 13 2012