http://d.puremagic.com/issues/show_bug.cgi?id=3986
Summary: Struct constructors bypass default initialization of member variables Product: D Version: 2.036 Platform: Other OS/Version: Windows Status: NEW Keywords: wrong-code Severity: blocker Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: clugd...@yahoo.com.au --- Comment #0 from Don <clugd...@yahoo.com.au> 2010-03-19 16:13:43 PDT --- If a struct constructor is called implicitly, member variables are not default initialized. Applies to D2.036 and later. Here's a simple test case with an assert that fails. (Beware: this test case doesn't capture the more complex case where one of the members is itself a struct with a constructor). I'm pretty sure the problem is in declaration.c, around line 1140. struct SiberianHamster { int rat = 813; this(string z) { } } void main() { SiberianHamster basil = "cybil"; assert(basil.rat == 813); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------