[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:36:33 PDT 2016


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

--- Comment #3 from Eyal <eyal at weka.io> ---
The workaround is pretty clear.

But this is nasty! Anyone who uses typeid(T).init in a generic way (not caring
what T is) is going to be broken.

It would be better to have typeid(staticArr).init throw a compile-time error
than to return the wrong result.

We've spent many hours reproducing and chasing this bug in a production build.

Additionally, x = x.init  would work without blowing up the stack when x is
large, and then accessing typeid() would be unnecessary.

--


More information about the Digitalmars-d-bugs mailing list