[Issue 14912] Move initialisation of GC'd struct and class data from the callee to the caller
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Aug 14 06:10:50 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14912
--- Comment #7 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Steven Schveighoffer from comment #6)
> Why would a template need memcpy?
>
> T *_d_newitem(T)()
> {
> // could eliminate typeid here
> T *result = cast(T *)GC.malloc(T.sizeof, typeid(T).flags);
> *result = T.init;
> return result;
> }
That's fine for anything except classes...
--
More information about the Digitalmars-d-bugs
mailing list