www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2650] New: TypeInfo_Ak and similar do not inherit from TypeInfo_Array

reply d-bugmail puremagic.com writes:
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.


-- 
Feb 07 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2650






Failing example:

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


-- 
Feb 07 2009
prev sibling parent d-bugmail puremagic.com writes:
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







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


-- 
Feb 07 2009