www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16394] New: TypeInfo.init() for static arrays returns single

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

          Issue ID: 16394
           Summary: TypeInfo.init() for static arrays returns single
                    element instead of whole array
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

unittest {
    void prop(T)() {
        assert(T.sizeof == typeid(T).tsize, "typeid(" ~ T.stringof ~ ").tsize
broken");
        assert(T.sizeof == typeid(T).init().length, "typeid(" ~ T.stringof ~
").init broken");
    }
    prop!int;
    prop!(int[3]);
}

Crashes for the 4th assertion, because init() returns a void[] array of size 4
instead of 12.

--
Aug 15 2016