Thread overview
[Issue 9197] New: Assigning structs with postblit to a member of another struct fails at CTFE
Dec 22, 2012
Dmitry Olshansky
Dec 22, 2012
Dmitry Olshansky
Dec 24, 2012
Dmitry Olshansky
Sep 09, 2013
Dmitry Olshansky
December 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9197

           Summary: Assigning structs with postblit to a member of another
                    struct fails at CTFE
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dmitry.olsh@gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-12-22 12:48:03 PST ---
This sample:

@trusted struct U
{
    this(this)
    {
    }
}

struct InvList
{
private:
    U data;
};

static InvList ivals()
{
    InvList list;
    //next line fails
    list.data = U.init;
    U a;
    //while this one works
    a = U.init;
    return list;
}

immutable foo = ivals();


Fails to compile with:
Error: CTFE internal error: unsupported assignment this = p
ctfe_this.d(18):        called from here: list.data.opAssign(U())
ctfe_this.d(24):        called from here: ivals()

Notice the first error without a line number.

Tested with lastest dmd from master.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9197


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker


--- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-12-22 13:22:17 PST ---
Looks I'm stuck with it in the middle of reworking the core part of new std.uni.

My attempt to sidestep it by doing the same in constructor didn't work out.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 24, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9197


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |normal


--- Comment #2 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-12-24 04:19:37 PST ---
Lovering severity as there is a workaround to construct data with __gshared + shared static this constructor. Not pretty but workable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 09, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9197


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

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


--- Comment #3 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-09-09 10:29:03 PDT ---
Was fixed somewhere during the 8 months since back then.

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