Bug 9197 – Assigning structs with postblit to a member of another struct fails at CTFE

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-22T12:48:00Z
Last change time
2013-09-09T10:29:03Z
Keywords
CTFE
Assigned to
nobody
Creator
dmitry.olsh

Comments

Comment #0 by dmitry.olsh — 2012-12-22T12:48:03Z
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.
Comment #1 by dmitry.olsh — 2012-12-22T13:22:17Z
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.
Comment #2 by dmitry.olsh — 2012-12-24T04:19:37Z
Lovering severity as there is a workaround to construct data with __gshared + shared static this constructor. Not pretty but workable.
Comment #3 by dmitry.olsh — 2013-09-09T10:29:03Z
Was fixed somewhere during the 8 months since back then.