www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10069] New: Assignment to 'this' fails inside struct constructor during CTFE

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

           Summary: Assignment to 'this' fails inside struct constructor
                    during CTFE
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: tommitissari hotmail.com


--- Comment #0 from Tommi <tommitissari hotmail.com> 2013-05-12 09:40:19 PDT ---
module main;

struct Test
{
    int v;

    this(int)
    {
        v = 123;
    }

    this(int, int)
    {
        this = test; // #1
    }
}

enum test = Test(1);

void main()
{
    enum t = Test(11, 22); // #2
}

// #1: Error: CTFE internal error: unsupported assignment this = Test(123)
// #2: called from here: Test(0).this(11, 22)

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