[Issue 16394] TypeInfo.init() for static arrays returns single element instead of whole array

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 15 15:26:05 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16394

--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> ---
It has been this way since the beginning (traced it back to this commit:
https://github.com/dlang/druntime/commit/1532910c769ab718a528c94c9157fecebd753c66)

Looking at the code, there really isn't a way to fix it without altering the
Object API or the compiler, both of which would break a lot of things.

We could have the compiler store the entire static array data into the data
section. This seems wasteful to say the least.

Is there not a way to handle TypeInfo_StaticArray specially? As far as I know,
it's going to be the only type that behaves this way.

Alternatively, you can check tsize() to see what the real size should be, and
then if that doesn't match initializer().length (use initializer instead of
init(), as init() is deprecated), then replicate if your plan is to initialize
to the initializer value.

--


More information about the Digitalmars-d-bugs mailing list