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

--- Comment #0 from Don <> 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:
------- You are receiving this mail because: -------

Reply via email to