Bug 2650 – TypeInfo_Ak and similar do not inherit from TypeInfo_Array
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2009-02-07T14:22:00Z
Last change time
2014-03-01T00:35:55Z
Assigned to
bugzilla
Creator
dhasenan
Comments
Comment #0 by dhasenan — 2009-02-07T14:22:51Z
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.
Comment #1 by dhasenan — 2009-02-07T14:32:27Z
Failing example:
void main ()
{
auto s = "hello"d;
auto sd = s[];
if (cast(TypeInfo_Array)typeid(typeof(sd)) !is null)
{
assert (false, "not array");
}
}
Comment #2 by dhasenan — 2009-02-07T14:45:41Z
*** This bug has been marked as a duplicate of 2218 ***