February 20, 2006 Comparing TypeInfo_Pointer | ||||
---|---|---|---|---|
| ||||
Comparing TypeInfo_Pointer`s doesn't work as expected because it uses TypeInfo's opEquals/opCmp which use the classinfo.name, but TypeInfo_Pointer (and _Array / friends) have their 'next' member with the actual classinfo name, so it's comparing the wrong data. e.g. even though typeid(int*).toString() and typeid(double*).toString() print out correct strings, they come out equal when comparing them because it's comparing the TypeInfo_Pointer strings and not the actual pointer types they refer to. |
February 24, 2006 Re: Comparing TypeInfo_Pointer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Miller Attachments: | Chris Miller schrieb am 2006-02-20: > Comparing TypeInfo_Pointer`s doesn't work as expected because it uses TypeInfo's opEquals/opCmp which use the classinfo.name, but TypeInfo_Pointer (and _Array / friends) have their 'next' member with the actual classinfo name, so it's comparing the wrong data. > > e.g. even though typeid(int*).toString() and typeid(double*).toString() print out correct strings, they come out equal when comparing them because it's comparing the TypeInfo_Pointer strings and not the actual pointer types they refer to. Added to DStress as http://dstress.kuehne.cn/run/t/typeid_88_A.d http://dstress.kuehne.cn/run/t/typeid_88_B.d http://dstress.kuehne.cn/run/t/typeid_88_C.d http://dstress.kuehne.cn/run/t/typeid_88_D.d http://dstress.kuehne.cn/run/t/typeid_88_E.d http://dstress.kuehne.cn/run/t/typeid_88_F.d Thomas |
Copyright © 1999-2021 by the D Language Foundation