Bug 462 – invalid typeinfo usage breaks dmd compiler

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-26T00:54:00Z
Last change time
2014-02-15T13:21:25Z
Assigned to
bugzilla
Creator
davidl

Comments

Comment #0 by davidl — 2006-10-26T00:54:58Z
import std.stdio; struct myobject { TypeInfo objecttype; void * offset; } myobject[] list; class off { int i; int j; void setserial() { list.length=list.length+1; list[list.length-1].typeinfo=i.typeinfo; // this breaks dmd list[list.length-1].objecttype=typeid(typeof(i)); list[list.length-1].offset=cast(void*)((cast(void*)(&i))-(cast(void*)this)); list.length=list.length+1; list[list.length-1].objecttype=typeid(typeof(j)); list[list.length-1].offset=cast(void*)((cast(void*)(&j))-(cast(void*)this)); } } void main() { off a=new off; a.setserial(); // serial(b); }
Comment #1 by thomas-dloop — 2006-11-08T09:36:38Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-10-26: > http://d.puremagic.com/issues/show_bug.cgi?id=462 > import std.stdio; > struct myobject > { > TypeInfo objecttype; > void * offset; > } > > myobject[] list; > class > off > { > int i; > int j; > void setserial() > { > list.length=list.length+1; > list[list.length-1].typeinfo=i.typeinfo; // this > breaks dmd > list[list.length-1].objecttype=typeid(typeof(i)); > > list[list.length-1].offset=cast(void*)((cast(void*)(&i))-(cast(void*)this)); > list.length=list.length+1; > list[list.length-1].objecttype=typeid(typeof(j)); > > list[list.length-1].offset=cast(void*)((cast(void*)(&j))-(cast(void*)this)); > } > } > void main() > { > off a=new off; > a.setserial(); > // serial(b); > > } Added to DStress as http://dstress.kuehne.cn/nocompile/t/typeinfo_02_A.d http://dstress.kuehne.cn/nocompile/t/typeinfo_02_B.d http://dstress.kuehne.cn/nocompile/t/typeinfo_02_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFUfnaLK5blCcjpWoRArwVAJ9j/S+qdSRA6XgJ7CA87D6iS4qoigCeOew3 eQxWdU3UGN7g3Vp28k9yS3Q= =Bwb+ -----END PGP SIGNATURE-----
Comment #2 by matti.niemenmaa+dbugzilla — 2006-11-15T02:59:28Z
Fixed in DMD 0.174.