that mutable typeinfo thing

Adam D. Ruppe destructionator at gmail.com
Sat Nov 21 05:46:25 UTC 2020


So I have my little `class TypeInfo_Aya {}` stub. Sometimes it 
works. But if I dare to add a string to a struct, it generates 
this infamous error:


arsd-webassembly/object.d(221): Error: Global variable type does 
not match previous declaration with same mangled name: 
`_D12TypeInfo_Aya6__initZ`
arsd-webassembly/object.d(221):        Previous IR type: 
%object.TypeInfo_Array = type { [4 x i8*]*, i8*, 
%object.TypeInfo* }, mutable, non-thread-local
arsd-webassembly/object.d(221):        New IR type:      
%object.TypeInfo_Aya = type { [4 x i8*]*, i8*, %object.TypeInfo* 
}, const, non-thread-local



So how do I tell it I just don't give a !@#$ and carry on? I 
tried looking at ldc/druntime's source and i don't see how their 
thing is any different.

Like I see the comment here 
https://github.com/ldc-developers/ldc/blob/c5b9f8a9048e46322301575546ed60fa79d5f2c9/ir/irstruct.cpp#L36

and yeah it definitely has to do with a struct... but like i just 
don't know the magic incantation to solve it.

btw tried pragma(LDC_no_typeinfo) on my struct too. ineffective.

i haven't tried compiling object.d as a separate .lib file... 
maybe with weak linkage? i really would prefer not to... but is 
that the answer? there must be something


More information about the digitalmars-d-ldc mailing list