Comment #0 by verylonglogin.reg — 2014-03-06T03:42:56Z
Compiler passes different `TypeInfo`-s in case associative array key
is array of classes or interfaces. Consider the following example:
---
void main()
{
Object[] a;
typeid(Object[]).getHash(&a); // Calls TypeInfo_Array.getHash
int[Object[]] aa = [a : 0];
assert(a in aa); // Calls TypeInfo_AC.getHash
}
---
This code should work fine:
---
alias T = Object[];
extern(C) inout(void)* _aaInX(inout void*, in TypeInfo keyti, in void* pkey)
{
assert(keyti is typeid(T)); // fails
return null;
}
void main()
{
T a;
int[T] aa = [a : 0];
assert(a !in aa);
}
---
And it works if `T` isn't an array of classes or interfaces.
Comment #1 by verylonglogin.reg — 2014-03-06T03:47:54Z
Filed Issue 12304 for the fact `TypeInfo_AC` is used for array of interfaces.
Comment #2 by robert.schadek — 2024-12-13T18:17:48Z