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: nob...@puremagic.com ReportedBy: verylonglogin....@gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin....@gmail.com> 2012-11-12 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: -------