Thread overview
[Issue 3535] New: struct constructors don't work in CTFE
Nov 20, 2009
Bill Baxter
Nov 20, 2009
Bill Baxter
Jan 10, 2010
Don
Jan 12, 2010
Walter Bright
Jan 31, 2010
Walter Bright
November 20, 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@puremagic.com
        ReportedBy: wbaxter@gmail.com


--- Comment #0 from Bill Baxter <wbaxter@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: -------
November 20, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3535



--- Comment #1 from Bill Baxter <wbaxter@gmail.com> 2009-11-20 15:50:40 PST ---
Additional note: static opCall does work with CTFE.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 10, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3535


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-01-10 11:44:54 PST ---
I have sent Walter a patch for this. This was much more difficult than you might expect.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 12, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3535


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2010-01-11 22:02:24 PST ---
Changeset 332

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3535


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-01-30 22:44:57 PST ---
fixed dmd 2.040

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