Thread overview
[Issue 2650] New: TypeInfo_Ak and similar do not inherit from TypeInfo_Array
Feb 07, 2009
d-bugmail
Feb 07, 2009
d-bugmail
Feb 07, 2009
d-bugmail
February 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2650

           Summary: TypeInfo_Ak and similar do not inherit from
                    TypeInfo_Array
           Product: D
           Version: 1.036
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: dhasenan@gmail.com


TypeInfo_Array is never derived and is only used for struct and char arrays (as far as I could tell). So you can't check if a type is an array type by casting the typeinfo to TypeInfo_Array.

The following types represent arrays and should inherit from TypeInfo_Array:
TypeInfo_AC
TypeInfo_Ar
TypeInfo_Aq
TypeInfo_Ad
TypeInfo_Af
TypeInfo_Ag
TypeInfo_Ai
TypeInfo_Al
TypeInfo_Ae
TypeInfo_As

The remainder of the specifically-defined array types inherit from these.


-- 

February 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2650





------- Comment #1 from dhasenan@gmail.com  2009-02-07 14:32 -------
Failing example:

void main ()
{
    auto s = "hello"d;
    auto sd = s[];
    if (cast(TypeInfo_Array)typeid(typeof(sd)) !is null)
    {
        assert (false, "not array");
    }
}


-- 

February 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2650


dhasenan@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dhasenan@gmail.com
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




------- Comment #2 from dhasenan@gmail.com  2009-02-07 14:45 -------


*** This bug has been marked as a duplicate of 2218 ***


--