Bug 4881 – _d_arrayliteralT() called in instances where a blit should suffice
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-09-17T14:01:00Z
Last change time
2013-10-24T13:24:40Z
Assigned to
nobody
Creator
sean
Comments
Comment #0 by sean — 2010-09-17T14:01:11Z
The following code will generate a call to _d_arrayliteralT() for the struct copy operation:
import core.stdc.stdlib;
struct List {}
struct GC
{
List*[1] free_list;
}
void main()
{
auto gc = cast(GC*) malloc(GC.sizeof);
*gc = GC.init; // _d_arrayliteralT() called here
}
Comment #1 by nfxjfg — 2010-09-17T14:31:35Z
Probably a duplicate of bug 2356 or bug 4397.
Comment #2 by schveiguy — 2010-09-17T15:01:48Z
It might be related but it's not a dup, because in those bugs, you actually are using array literals. I don't see any array literal's in Sean's example. In fact, there's no dynamic arrays anywhere.
Comment #3 by nfxjfg — 2010-09-17T15:24:43Z
There are no array literals in bug 4397 either. But maybe the same underlying cause because there seems to be something REALLY wrong how the compiler handles initializing structs with arrays in it, or array initialization.
Comment #4 by schveiguy — 2010-09-17T15:33:49Z
const cX = X([1,2]);
that [1,2] sure looks like a literal to me...
Legitimately, you could say the compiler should be able to call _d_arrayliteralT once to initialize cX, but not call it every time cX is used.
But I think it's different than this bug.
Comment #5 by yebblies — 2012-02-01T20:34:11Z
*** This issue has been marked as a duplicate of issue 2356 ***
Comment #6 by verylonglogin.reg — 2013-10-24T13:24:40Z
This is now a duplicate of Issue 11345 because of fixing Issue 11238.
*** This issue has been marked as a duplicate of issue 11345 ***