March 06, 2014 [Issue 12303] New: Different `TypeInfo`-s for array of classes or interfaces as associative array key | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=12303 Summary: Different `TypeInfo`-s for array of classes or interfaces as associative array key Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: verylonglogin.reg@gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2014-03-06 15:42:56 MSK --- 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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 06, 2014 [Issue 12303] Different `TypeInfo`-s for array of classes or interfaces as associative array key | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | https://d.puremagic.com/issues/show_bug.cgi?id=12303 --- Comment #1 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2014-03-06 15:47:54 MSK --- Filed Issue 12304 for the fact `TypeInfo_AC` is used for array of interfaces. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation