[Issue 6396] New: enums + struct initializers == wrong code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 28 12:40:39 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6396

           Summary: enums + struct initializers == wrong code
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-07-28 12:40:37 PDT ---
struct S {
    bool b;
    double d = 3.14159265;
    int i = 42;
}

enum S s = {b : true};

void main() {
    import std.stdio;
    writeln(s.d);  // nan
    writeln(s.i);  // 0
}

Changing the enum to immutable fixes this.

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


More information about the Digitalmars-d-bugs mailing list