www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Comparing TypeInfo_Pointer

reply "Chris Miller" <chris dprogramming.com> writes:
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.
Feb 20 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFD/q983w+/yD4P9tIRAhPdAKCb6zqWx0SHoW9urfHRE1YM4juffgCdHrkJ 8Sd8T5h2PKKrBIoJqtab1G8= =fquN -----END PGP SIGNATURE-----
Feb 23 2006