digitalmars.D.bugs - [Issue 3622] New: Nested structs as default function arguments not initialized
- d-bugmail puremagic.com (45/45) Dec 16 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3622
- d-bugmail puremagic.com (12/12) Dec 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3622
http://d.puremagic.com/issues/show_bug.cgi?id=3622 Summary: Nested structs as default function arguments not initialized Product: D Version: 2.036 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: tomeksowi gmail.com PST --- Strangely enough it happens only if the nested struct is forward referenced. Looks like the default argument is not initialized at all in these cases. Testcase (should pass): struct Strukt { int pole; Wsk wsk; this(int pole, Wsk wsk = Wsk()) { this.pole = pole; this.wsk = wsk; } static Wsk zla_funkcja(uint i, Wsk wsk = Wsk()) { return wsk; } struct Wsk { Strukt* w; } static Wsk funkcja(uint i, Wsk wsk = Wsk()) { return wsk; } } void main() { auto ok = Strukt.funkcja(7); assert(!ok.w); // passes auto zly = Strukt.zla_funkcja(7); assert(!zly.w); // boom! auto s = Strukt(6); assert (!s.wsk.w); // boom! } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 16 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3622 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED Fixed DMD2.038. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 08 2010