[Issue 3535] New: struct constructors don't work in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 20 15:49:12 PST 2009


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

           Summary: struct constructors don't work in CTFE
           Product: D
           Version: 2.036
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: wbaxter at gmail.com


--- Comment #0 from Bill Baxter <wbaxter at gmail.com> 2009-11-20 15:49:09 PST ---
struct Struct
{
    this(int _n) {
        n = _n; x = 5;
    }
    this(int _n, float _x) {
        n = _n; x = _x;
    }
    int n;
    float x;
}

enum A = Struct(1);  
enum A = Struct(1,2);


Both calls fail.  But if you /don't/ define any constructors then the second
one would work.

-- 
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